Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

reading a 1D variable into 2D memory

Hello,

I have a netCDF file with data stored in a one-dimensional variable that represents two-dimensional data in physical representation i. e. the 2-D data has been collapsed into 1-D.

I would like to read in a rectangular subset (hyperslab) of this variable into a 2-D array in a program. I can calculate the starting point for the read and the number of values to be read, but in this case, the hyperslab of values are not contiguous in the variable in the netCDF file. I want to read e. g. 3 values, then skip 100 values, then 3 more values, skip 100, etc.

At the risk of having missed something really obvious, is there a way to read the values without making multiple calls to nf90_get_var()? The "stride" argument to get_var seems to only allow me to read one value before skipping ahead in the file; what do I do to read a series of values?

I am using netCDF for Fortran90 v 3.5 on MacOS X 10.3

Thank you for your help.

Cheers,

Jed Kaplan


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690