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
  Tkinter: Problem with storing data from one window to the other iforire 1 135 Yesterday, 01:31 PM
Last Post: deanhystad
  problems with netcdf if I compile Android Blaubart 10 754 May-10-2025, 07:05 PM
Last Post: Blaubart
  tkinter only storing last element/data from entry widget bertschj1 8 744 May-06-2025, 11:54 PM
Last Post: deanhystad
  LLM data I/O - for storing notes Alkanet 0 415 Dec-19-2024, 09:08 AM
Last Post: Alkanet
  To fetch and iterate data from CSV file using python vyom1109 3 1,129 Aug-05-2024, 10:05 AM
Last Post: Pedroski55
  Storing data in readable place user_404_lost_and_found 4 1,546 Jul-22-2024, 06:14 AM
Last Post: Pedroski55
  Reading and storing a line of output from pexpect child eagerissac 1 6,792 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 2,156 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 2,082 Aug-03-2022, 06:03 AM
Last Post: Pedroski55
  Storing variables into one file for use in multiple Jupyter notebooks devansing 1 2,827 Feb-05-2022, 10:04 AM
Last Post: ibreeden

Forum Jump:

User Panel Messages

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