Python Forum
Storing Python data output as a Netcdf file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Storing Python data output as a Netcdf file
#1
Hi there,

I just derived values from a 3D matrix, which contains the dimensions of time (in years), latitude (64 lines), and longitude (128 lines). The values derived are for every grid cell (latitude and longitude) for each year for 140 years (so, LOTS of values in the output). I would like to store the output data (which, again, contains values for every grid cell) as a netcdf file and wanted to know how this can be done?

Secondly, does the creation of the file affect the original structure of my dataset? If so, is it possible to preserve the data in its current state (i.e. maintain the latitude/longitude structure)?

Also, does the command need to be written at the end of my code?

Any help would be greatly appreciated!
Reply
#2
(May-16-2018, 08:02 PM)Lightning1800 Wrote: I would like to store the output data [...] as a netcdf file and wanted to know how this can be done?
I Googled "python netcdf" and the third result had the title "Generating NetCDF files with Python". You should start there. For things like this, which are very specialized, you're not very likely to get a satisfying answer here unless we do what you probably could have done.

(May-16-2018, 08:02 PM)Lightning1800 Wrote: Secondly, does the creation of the file affect the original structure of my dataset?
It depends on your code, but I would expect not.

(May-16-2018, 08:02 PM)Lightning1800 Wrote: Also, does the command need to be written at the end of my code?
I'm not quite sure what you meant by this. You can't populate the file until after you have the data that would be in it. Once you have that data ready, you can create the file at any point after that.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading and storing a line of output from pexpect child eagerissac 1 4,224 Feb-20-2024, 05:51 AM
Last Post: ayoshittu
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,089 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  How to modify python script to append data on file using sql server 2019? ahmedbarbary 1 1,215 Aug-03-2022, 06:03 AM
Last Post: Pedroski55
  Storing variables into one file for use in multiple Jupyter notebooks devansing 1 1,731 Feb-05-2022, 10:04 AM
Last Post: ibreeden
Photo how I write the output into xml file in python? 3lnyn0 1 2,224 Oct-31-2021, 05:40 PM
Last Post: Gribouillis
  Showing and saving the output of a python file run through bash Rim 3 2,426 Oct-06-2021, 10:48 AM
Last Post: gerpark
  Help with storing temp data for each day then recording min/max in app. trthskr4 3 2,402 Sep-10-2021, 10:51 PM
Last Post: trthskr4
  Code should download and output trading data tayy 2 2,636 Mar-04-2021, 04:07 AM
Last Post: tayy
  xml file creation from an XML file template and data from an excel file naji_python 1 2,097 Dec-21-2020, 03:24 PM
Last Post: Gribouillis
  Databricks, Python Notebook Data file use issue khalid2200 0 1,754 Nov-25-2020, 03:36 AM
Last Post: khalid2200

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020