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

[netCDF #TUX-625077]: How to specify missing values in *.nc files ...



Hi Yonghe,

> I am using your F90 program to convert a series of 2D arrays into a NETCDF 
> file.
> There are many NODATA_values (-9999) in the arrays and I need to label them
> as missing values in the NC file (so I can use NCVIEW to view the 2D grids.)
> 
> Now the NC file looks like
> 
> netcdf write_test {
> dimensions:
> time_level = 1 ;
> latitude = 480 ;
> longitude = 570 ;
> time = UNLIMITED ; // (1 currently)
> variables:
> float latitude(latitude) ;
> latitude:units = "meters_north" ;
> float longitude(longitude) ;
> longitude:units = "meters_east" ;
> float FFMC_code(time, time_level, latitude, longitude) ;
> FFMC_code:units = "unitless" ;
> data:
> ... ... ...
> 
> What I need is like this
> ... ... ...
> float FFMC_code(time, time_level, latitude, longitude) ;
> FFMC_code:units = "unitless" ;
> FFMC_code:missing value = "-9999";

The attribute should be named "missing_value" or "_FillValue"
instead of "missing value", for ncview to understand it.  Note
the use of the "_" character instead of a blank character " ".

> ... ... ...
> 
> Could you please tell me how to modify my program to get this?
> (Please find my F95 program as attached, it is just a copy of your
> example programs downloaded from your website).

After

  !-----------------------------------------------------------
  ! Assign units attributes to the netCDF variables.
  !------------------------------------------------------------
  call check( nf90_put_att(ncid, vars_varid, UNITS, VARS_UNITS) )

insert the statement

  call check( nf90_put_att(ncid, vars_varid, "_FillValue", -9999) )

--Russ


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



Ticket Details
===================
Ticket ID: TUX-625077
Department: Support netCDF
Priority: Normal
Status: Closed