[Thread Prev][Thread Next][Index]

[ferret_users] Re: [ferret users] Transform grid



Hi,
When a netCDF file is created, bad or missing data should be marked with some value, which is listed in the missing_value attribute for the variable. Sometimes somebody makes a file where missing or bad values are NaN, and Ferret can deal with this as follows:  (see "NaN in netCDF files" in the Users Guide).
If there are values of NaN in the file, then NaN must be listed in either the as either the "missing_value" OR  "_FillValue" attribute and then NaN is the missing value.  Or, the user may specify SET VARIABLE/BAD=NAN (case insensitive) to  designate the Fortran value NaN (not a number) as the bad value flag for a given variable in a netCDF dataset.
Looking back at the piece of ncdump output you sent before, I see that there is also a missing_value=-999. attribute in the file. If there are values of -999 as well as the NaN's then you might need to fix up the file with perhaps NCO operators to specify NaN as the "_FillValue" attribute. Again from the Ferret Users Guide,
For netCDF input data sets the missing value flag(s) is indicated by the values of the attributes "missing_value" and "_FillValue." If both attributes are defined to have different values both will be recognized and used by Ferret as missing value indicators, however the occurrences of _FillValue will be replaced with the value of missing_value as the data are read into Ferret's memory cache so that only a single missing value flag is apparent inside of Ferret.
Or, you could do the  SET VAR/BAD=NAN and then use a mask on your variable
yes? use/order=xyt HADiSST_1_1_SST_2004.nc
yes? SET VAR/BAD=NAN sst
yes? let sst2 = if sst GT -20 then sst
yes? shade/L=1 sst2
There are some ideas in this message from the Users List archive,
http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_96/msg00074.html

Yun.Li@xxxxxxxx wrote:

Hi Ansley,

 

Thanks for you helpful comments. “use/order=xyt” works well to reshape the grid.

 

yes? use/order=xyt HADISST_1_1_SST_2004.nc

yes? show grid sst

 Default grid for DEFINE VARIABLE is ABSTRACT

 Last successful data access was on grid GBR4

    GRID GBR4

 name       axis              # pts   start                end

 NI        X                  360 r   1                    360

 NJ        Y                  180 r   1                    180

 normal    Z

 NR        T                   12 r   1                    12

 

However, I cannot create the correct figures using Fill and plot commands for the regions including missing values (nan) in the data.  The errors in the graphs contain many lines pointing to the outside of plot area, and metafile.plt created by ferret cannot be changed to .ps file by gksm2ps.  Is there a way to fix this nan problem?

 

yes? list/i=1/J=1:5 SST

             VARIABLE : SST (deg)

             FILENAME : HADISST_1_1_SST_2004.nc

             SUBSET   : 5 by 12 points (Y-T)

             X        : 1

               1      2      3      4      5   

               1      2      3      4      5

 1    /  1:    nan -18.00 -18.00 -18.00 -18.00

 2    /  2:    nan    nan    nan    nan    nan

 3    /  3:    nan    nan    nan    nan    nan

 4    /  4:    nan    nan    nan    nan    nan

 5    /  5: -18.00 -18.00 -18.00    nan    nan

 6    /  6:    nan    nan    nan    nan    nan

 7    /  7: -18.00 -18.00 -18.00 -18.00 -18.00

 8    /  8: -18.00 -18.00 -18.00 -18.00 -18.00

 9    /  9: -18.00 -18.00 -18.00 -18.00 -18.00

 10   / 10: -18.00 -18.00 -18.00 -18.00 -18.00

 11   / 11:    nan -18.00 -18.00 -18.00 -18.00

 12   / 12: -18.00 -18.00 -18.00 -18.00 -18.00

 

Regards,

 

Yun

 


From: Ansley Manke [mailto:Ansley.B.Manke@xxxxxxxx]
Sent: Wednesday, 28 February 2007 3:18 AM
To: Li, Yun (CMIS, Floreat)
Cc: oar.pmel.ferret_users@xxxxxxxx
Subject: Re: [ferret users] Transform grid

 

Hi Yun,
Yesterday you got some ideas about how to reshape the grid of the variable SST to be able to plot it.  Another method would be to tell Ferret the order of the axes when you open the file. I think this is what you need

  yes? use/order=xyt HADISST_1_1_sst_2004.nc
  yes? show grid sst

If there are missing SST values this should not be a problem. What plot command are you using? What error message are you seeing? 

Yun.Li@xxxxxxxx wrote:

Hi Ansley,

 

I am using ferret/5.81.  I have another problem to using “Fill/L=7 SST” to make ferret plots because there are missing SSTs at some grids in the HADISST_1_1_SST_2004.nc.  Can you please let me know how to plot SST image when there are missing values on some grid.

 

The output of ncdump of  HADISST_1_1_SST_2004.nc are as follows.

 

 

sst> ncdump -h HADISST_1_1_SST_2004.nc

netcdf HADISST_1_1_SST_2004 {

dimensions:

        nr = UNLIMITED ; // (12 currently)

        in = 360 ;

        no = 180 ;

variables:

        double t(nr) ;

                tunics = "years" ;

                t:long_name = "Fake time" ;

                t:coordinate_type = "time" ;

        float lon(in) ;

                lon:units = "degrees_east" ;

                lon:long_name = "Longitude" ;

                lon:coordinate_type = "longitude" ;

        float lat(no) ;

                lat:units = "degrees_north" ;

                lat:long_name = "Latitude" ;

                lat:coordinate_type = "latitude" ;

        float sst(nr, no, in) ;

                sst:long_name = "SST" ;

                sst:units = "deg" ;

                sst:missing_value = -999.f ;

                sst:coordinates = "t, lat, lon" ;

 

// global attributes:

                :Conventions = "CMR/Timeseries" ;

}

 

Yun Li

 


From: Ansley Manke [mailto:Ansley.B.Manke@xxxxxxxx]
Sent: Tuesday, 27 February 2007 2:43 AM
To: Li, Yun (CMIS, Floreat)
Cc: oar.pmel.ferret_users@xxxxxxxx
Subject: Re: [ferret_users] Transform grid

 

Hi Yun Li,
If the name of the "Fake Time" axis is T, then Ferret should detect that axis as an axis in the T direction.  Could you tell me what version of Ferret are you using, and could you send me the output of the Unix ncdump command
 
   ncdump -h HADISST_1_1_SST_2004.nc

Ansley

Yun.Li@xxxxxxxx wrote:

Dear All,
 
I have a copy of monthly HADISST_1_1_SST_2004.nc as follows. 
 
yes? use HADISST_1_1_SST_2004.nc
yes? show data
     currently SET data sets:
    1> ./HADISST_1_1_SST_2004.nc  (default)
 name     title                             I         J         K
L
 T        Fake time                        1:12      ...       ...
...
 LON      Longitude                        1:360     ...       ...
...
 LAT      Latitude                         1:180     ...       ...
...
 SST      SST                              1:360     1:180     1:12
...
 
 
Ferret cannot draw the plots properly due to the incorrect grid settings
(K =1:12). Could you please help me to transform the grid as the correct
format (L=1:12)? That is,
 
  
show data
    
     currently SET data sets:
    1> ./HADISST_1_1_SST_2004.nc  (default)
 name     title                             I         J         K
L
 SST      SST                              1:360     1:180     ...
1:12
 
 
Regards,
 
Yun Li
CSIRO, Australia
 
  

 

 

-- 

~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~> 

Ansley Manke, NOAA/PMEL   ansley.b.manke@xxxxxxxx
7600 Sand Point Way NE, Seattle WA
Phone 206-526-6246,  FAX 206-526-6744


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement