[Thread Prev][Thread Next][Index]

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



Ansley Manke a écrit :
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





Cliquez ici <https://www.mailcontrol.com/sr/3ZuPWjxzrFcBMC5TJeZ2dUfK8eMmGgcuf%2166NrBUsCcQG64UImLu5Ga3C10sUHexRuShiRIC6jRCCzZIChncDek80fUprGx%21E1f8ihh8CqRwR+z8XT0XFkR7EyZQW79JTFD7zlQ6sVB3gA8I8mUAYv7oe5OBIW4Elz63Uk5fl84nirg9zl+Fiyo5ffRBzBGOScxUbMTLFPbhZgB%21tlhEhRqRVZ%21%21rMKK> si ce message est indésirable (pourriel).

Ansley, it does'nt work properly yet, but it is in good progress :

yes? let xx=longitude
yes? list/i=1116:1129 xx
            VARIABLE : LONGITUDE
            DATA SET : SST collated file: avhrr17_g 20070917
FILENAME : TsurfAv17jL2pnv_20070917_103456_0079_-060_-044_0135.cfs.nc
            SUBSET   : 14 points (X)
1116   / 1116:  359.6
1117   / 1117:  359.6
1118   / 1118:  359.7
1119   / 1119:  359.7
1120   / 1120:  359.8
1121   / 1121:  359.8
1122   / 1122:  359.8
1123   / 1123:  359.9
1124   / 1124:  359.9
1125   / 1125:  360.0
1126   / 1126:    0.0
1127   / 1127:    0.0
1128   / 1128:    0.1
1129   / 1129:    0.1
yes? let new_longitude = if xx GT 180 then (xx-360) else xx
yes? list/i=1116:1129 new_longitude
            VARIABLE : IF XX GT 180 THEN (XX-360) ELSE XX
            DATA SET : SST collated file: avhrr17_g 20070917
FILENAME : TsurfAv17jL2pnv_20070917_103456_0079_-060_-044_0135.cfs.nc
            SUBSET   : 14 points (X)
1116   / 1116: -0.3999
1117   / 1117: -0.3599
1118   / 1118: -0.3199
1119   / 1119: -0.2799
1120   / 1120: -0.2399
1121   / 1121: -0.1999
1122   / 1122: -0.1599
1123   / 1123: -0.1199
1124   / 1124: -0.0799
1125   / 1125: -0.0399
1126   / 1126:  0.0001
1127   / 1127:  0.0401
1128   / 1128:  0.0801
1129   / 1129:  0.1201
yes? define axis/modulo/units=degrees_east longitude=new_longitude
*** NOTE: Orientation not specified via /X,/Y,/Z, or /T. X assumed.
Replacing definition of axis LONGITUDE
*** NOTE: grid used by data set TsurfAv17jL2pnv_20070917_103456_0079_-060_-044_0135.cfs
*** NOTE: Redefinition may alter apparent contents of data set
*** NOTE: grid used by data set TsurfAv17jL2pnv_20070917_103456_0079_-060_-044_0135.cfs
*** NOTE: Redefinition may alter apparent contents of data set
yes? shade TEMPERATURE_DE_SURFACE_DE_LA_MER : plots in x axis the latitude and in y axis a variable named "z (degrees_east)" which values are longitude values

How may I tell to ferret to put the longitude in x and latitude in y ?


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ JACQUES STUM ~~ E-mail : jstum@xxxxxx
Collecte Localisation Satellite,
8-10 rue Hermès,                                 	     ~~	  Phone   :  33 5 61 39 48 12
Parc Technologique du Canal,
31526 Ramonville Saint-Agne, France	     ~~    	  Fax	 :  33 5 61 39 37 82
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement