[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 20020618: netCDF: Problem displaying array of values
- Subject: Re: 20020618: netCDF: Problem displaying array of values
- Date: Thu, 20 Jun 2002 11:04:44 -0600
>To: address@hidden
>From: Naveenta Anand <address@hidden>
>Subject: Re: 20020618: netCDF: Problem displaying array of values
>Organization: Fisheries and Oceans Canada, Ottawa
>Keywords:
Naveenta,
> I am experiencing another funny problem as follows. I have embedded my
> function
> call that converts ASCII to netCDF form. Basically, the funny thing is that
> my
> nc_put-Var statements are not working as I have inputted them in my program.
> If
> you see below, you will see that I have 6 variables and thus 6 put_var
> statements for them in the code.
>
> Now, in the netCDF output it only displays latitude and longitude in the
> variable section and nothing else. If I completely remove the put_var section
> even then it continues to display latitude and longitude (the last 2
> variables). Isn't that funny?
>
> I am including a sample of CURRENT netCDF output (in red) below the code
> section (in black).
The reason ncdump does not show any of the other variables, is because
they are record variables (use the unlimited dimension) and you have
not written any records yet:
PRIMARY_DIMENSION = UNLIMITED ; // (0 currently)
The (0 currently) says there are currently no records. Only the
LATITUDE and LONGITUDE variables are not record variables, so they
appear in the ncdump output, each having a single fill value:
data:
LATITUDE = _ ;
LONGITUDE = _ ;
The reason you aren't writing any records (or any data) is because you
are specifying a 0 count for how much data to write:
size_t count[] = {primary_dimension_len};
If you want to write 1 record of data, then you should specify:
size_t count[] = {1};
Similarly, the following statements currently don't write any data
because count[0] is 0:
stat = nc_put_vara_float(ncid,latitude_id,index,count,&fill);
stat = nc_put_vara_float(ncid,longitude_id,index,count,&fill);
In looking at your CDL, I noticed a few other things that will cause
problems:
- The units specifications you are using are not parsable by the
udunits library with a default units file, so won't be very useful
for programs that need to interpret the units or transform to other
units. If you wanted to use udunits specifications, you should see
the udunits documentation and use
"degrees_north" or instead of "Degrees" for LATITUDE
"degrees_east" instead of "Degrees" for LONGITUDE
"meters" or "m" instead of "Metres"
"days since 2000-01-01" instead of "yyyymmdd" (for example)
"hours" instead of "hhmiss" (for example)
For an example of a CDL file that uses units as intended for the
udunits package, see some of the CDL files in
ftp://ftp.unidata.ucar.edu/pub/netcdf/cdl/
or see the Conventions documents for netCDF representations of
oceanographic and atmospheric sciences data at
http://www.unidata.ucar.edu/packages/netcdf/conventions.html
especially the COARDS or CF or PMEL-EPIC conventions.
- The _FillValue attributes you are using for WOCE_TIME_OF_DAY and
SEA_LEVEL variables are of the wrong type, since the _FillValue
type should match the type of the variable (in this case float).
- I would recommend not using the "_DIMENSION" suffix on dimension
names, since this precludes using the useful coordinate variable
convention, where the coordinate variable corresponding to a
dimension is given the same name as the dimension. Again, see some
of the convention documents above for good naming conventions for
dimensions and variables.
--Russ
_____________________________________________________________________
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu