[Thread Prev][Thread Next][Index]

Re: [ferret_users] ferret failure to plot Netcdf file (precision problem ?)



Hi Jacques,
Thanks for including details on the contents of the file. That makes it possible to see what's happening.

The trouble with the coordinates in this data set is not the value 9.20000000022014e-05 but the fact that the numbers jump from 359.xxx to 0.xxx.  We humans know that this is the modulo branch cut but that information isn't deduced from the coordinate values. The coordinate values themselves must be strictly increasing or decreasing.  If for instance the coordinates for the grid run from 180 up to 359.96, 0.0, 0.04, 0.08, and on up to 179.96 then you'd get correct results if you changed them to run from -180, ..., -0.04, 0.0, 0.4, ... to 179.96.

(Here is the data standard that Ferret uses for netCDF files, just for reference:
http://ferret.pmel.noaa.gov/Ferret/documentation/coards-netcdf-conventions)

Ferret can probably fix this file without having to remake the netCDF file. To fix this, you can redefine the axis.  This is just an example assuming the coordinates run as I said above, you can adjust this to fit what the axis actually does, making the definition of the variable new_longitude into a monotonic variable that is the equivalent of the coordinates in the file.

yes? use TsurfAv17jL2pnv_20070917_103456_0079_-060_-044_0135.nc

yes? ! Define a variable with the same longitudes, but monotonic
yes? let xx = longitude
yes? let new_longitude = if xx GT 180 then (xx-180) else xx

yes? ! check what we have done
yes? list/i=1116:1129 new_longitude
yes? plot new_longitude

yes? ! Redefine the LONGITUDE axis
yes? define axis/modulo/units=degrees_east longitude = new_longitude

yes? !now you should see the plot on the longitude-latitude grid
yes? shade TEMPERATURE_DE_SURFACE_DE_LA_MER

Jacques Stum wrote:
Hello Ferret users,

Ferret failed to plot my NetCdf file as follows :

$ferret
       NOAA/PMEL TMAP
       FERRET v6
       Linux(g77) 2.4.21-32 - 08/23/06
       29-Nov-07 14:14

yes? set memory/size=128
Cached data cleared from memory
yes? use TsurfAv17jL2pnv_20070917_103456_0079_-060_-044_0135.nc
*** NOTE: Coordinates out of order or missing on axis Longitude at subscript 1126
*** NOTE: A dummy axis of subscripts will be used
yes? show data
    currently SET data sets:
   1> ./TsurfAv17jL2pnv_20070917_103456_0079_-060_-044_0135.nc  (default)
name     title                             I         J         K         L
LONGITUDE
         Longitudes                       1:4500    ...       ...       ...
      (invalid coordinate axis)
TEMPERATURE_DE_SURFACE_DE_LA_MER
         sea surface temperature          ...       1:3500    1:4500    ...

yes? shade TEMPERATURE_DE_SURFACE_DE_LA_MER
yes? quit

The result is : Ferret outputs a 2-D plot, but with x = Latitude, and y = a number between 1 and 4500 (expected : a 2-D plot with x = Longitude, and y = Latitude !)

Hereafter is the ncdump of my file : I just show you a subset of the LONGITUDE variable, between subscripts 1116 and 1129. It seems that Ferret does'nt interpret correctly subscript 1126 (Longitudes(1126) = 9.20000000022014e-05)

netcdf TsurfAv17jL2pnv_20070917_103456_0079_-060_-044_0135.cfs {
dimensions:
   Latitude = 3500 ;
   Longitude = 4500 ;
   double Latitude(Latitude) ;
       Latitude:_FillValue = 1.84467440737096e+19 ;
       Latitude:long_name = "Latitudes" ;
       Latitude:units = "degrees_north" ;
       Latitude:standard_name = "latitude" ;
   double Longitude(Longitude) ;
       Longitude:_FillValue = 1.84467440737096e+19 ;
       Longitude:long_name = "Longitudes" ;
       Longitude:units = "degrees_east" ;
       Longitude:standard_name = "longitude" ;
   short Temperature_de_surface_de_la_mer(Longitude, Latitude) ;
       Temperature_de_surface_de_la_mer:_FillValue = 32767s ;
       Temperature_de_surface_de_la_mer:long_name = "sea surface temperature" ;
       Temperature_de_surface_de_la_mer:units = "degC" ;
       Temperature_de_surface_de_la_mer:scale_factor = 0.01 ;
       Temperature_de_surface_de_la_mer:add_offset = 0. ;
       Temperature_de_surface_de_la_mer:standard_name = "sea_surface_temperature" ;
       Temperature_de_surface_de_la_mer:valid_min = -162s ;
       Temperature_de_surface_de_la_mer:valid_max = 2793s ;

Longitude(1116:1129) =   359.600092, 359.640092, 359.680092, 359.720092, 359.760092, 359.800092,
359.840092, 359.880092, 359.920092, 359.960092, 9.20000000022014e-05,
0.0400920000000022, 0.0800920000000022, 0.120092000000002


Is it a known unavoidable Ferret bug, or is there a means to avoid it, maybe by telling to Ferret something more on the input data precision (double ?)

Thank you for your help,

Jacques




[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement