NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: reading a 1D variable into 2D memory

Jed,

I don't know of any way to read an arbitrary 2-D mapping of a 1-D,
netCDF variable into memory with a single call to the C or Fortran
interface.

You might be able to do this with the Java interface, however.

Regards,
Steve Emmerson

>Date: Thu, 26 Feb 2004 18:00:46 +0100
>From: "Jed O. Kaplan" <jed.kaplan@xxxxxx>
>To: netcdfgroup@xxxxxxxxxxxxxxxx
>Subject: reading a 1D variable into 2D memory
>
> 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

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