[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #VMR-409919]: HELP: netCDF data access and export in Python



Hi Manuel,

> I have to select and export oceanographic data from a netCDF file depending 
> on time slices.
> I am using the netCDF4 library together with numpy, scipy and gdal.
> So far I can already read the parts of the nc file (dimensions, variables, 
> attributes).
> 
> Now my questions:
> 
> 1) How can I access the "water surface elevation" variable values for a 
> certain time slice?
> I don't really understand the principle, because if I print the variable I 
> get all values, of course.
> So, may I have to join the time to the elevation values at first? I don't 
> know how the records are assigned to the time values.

Sorry, we can answer such a question for the C, Java, C++, or Fortran 
interfaces, but all the Python 
APIs for netCDF are developed and supported elsewhere, and they have different 
APIs.  For example,
if you're using Jeff Whitaker's netCDF-4 module for python: 
http://code.google.com/p/netcdf4-python/,
you should contact him for answers to questions about his API.

> 2) What kind of data type should I use? (multidimensional array, ... because 
> the file has >7GB)

I expect you'd want a 2D array for "water surface elevation" at a specified 
time.  It should
be possible to read in each time slice separately into such a 2D array.

> 3) I want to use GDAL for generating a Shapefile out of the selected time 
> slices. Is it better to cache the selected data (to ASCII file, ...) or doing 
> a direct shp creation? Considering the read/write performance.

Sorry, we didn't develop and don't support the GDAL library either, so I can't 
answer that
question.

--Russ

> Here's a part of the file structure:
> ----------------------------------------
> dimensions:
> time = unlimited (49 currently)
> zip2 = 1076093
> 
> variables:
> double time(time)
> time:long_name = "coordinate variables of time"
> time:units = "seconds since 2010-08-09"
> 
> float e (time,zip2)
> e:long_name = "water surface elevation from still water level"
> e:units = "meter"
> e:figure = "scalar"


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: VMR-409919
Department: Support netCDF
Priority: Normal
Status: Closed


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.