Re: [netcdfgroup] Need help to convert .csv files to netCDF files

  • To: "Signell, Richard" <rsignell@xxxxxxxx>
  • Subject: Re: [netcdfgroup] Need help to convert .csv files to netCDF files
  • From: Chris Barker <chris.barker@xxxxxxxx>
  • Date: Fri, 6 Mar 2015 14:39:36 -0800
On Fri, Mar 6, 2015 at 2:32 PM, Signell, Richard <rsignell@xxxxxxxx> wrote:

> If you like python, this seems like a perfect application for xray
> (http://xray.readthedocs.org/en/stable/, which adopts a common data
> model representation in python.
>

cool! I'd forgotten about that one -- I was thinking a pacakge that could
read-write both netcdf and csv would be good.

I was thinking Iris, too:

http://scitools.org.uk/iris/

But it doesn't seem to support CSV out of the box. However, you could read
the CSV, create a data cube from scratch, and then write that out to netcdf.

If it's a bit picky for creating the data cube -- but that's a good thing
-- it will force you to conform to the CF data model, so you'll get a  nice
CF compliant netcdf file without having to do as much work to figure out
the standard from teh docs.

> And I adapted it here to create a simple program that  reads CSV data
> using Pandas, converts to an xray Dataset, adds metadata, and then
> uses an xray method to write to NetCDF:
>
>
> http://nbviewer.ipython.org/github/rsignell-usgs/notebook/blob/master/csv2netcdf.ipynb


That is pretty cool! I need to keep xray in mind...

-CHB


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@xxxxxxxx
  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: