[Thread Prev][Thread Next][Index]

Re: [ferret_users] wrong x - axis processing AVHRR daily data



Hi Martin,

You are right, Ferret should be able to do this correctly without special workarounds.

When Ferret reads the coordinates, they are correctly determined to be regularly-spaced, as the file says, but the grid box size for longitudes is 360/8640 = 0.04166666... The axis length is computed to be slightly larger than 360:

yes? say `xboxhi[gx=sea_surface_temperature,i=8640] - xboxlo[gx=sea_surface_temperature,i=1]`
 !-> MESSAGE/CONTINUE 360.0000101737036
360.0000101737036

We have run into similar issues having to do with coordinate precision, but clearly we still do not have everything working correctly. I have put this on our list of needed fixes.

Another workaround would be explicit limits in the i direction:

   yes? save/clobber/file=test.nc/outtype=float/i=1:`sst,return=isize` sst

This keeps the LON axis as it was in the original file.

By the way, you might want to inherit the attributes from sea_surface_temperature to the new variable sst, with
SET ATTRIBUTES/LIKE=

-Ansley

On 3/22/2017 11:19 AM, Martin Schmidt wrote:
Hi,
I am trying to work with global daily AVHRR v5.2. data, downloaded from ftp://ftp.nodc.noaa.gov/pub/data.nodc/pathfinder/Version5.2. I am trying to build a regional subset and monthly averages. Working with the data, I noticed a zonal shift between the derived monthly data and the landmask.
It seems ferret (pyferret7.0 or pyferret7.1) is the reason

With ncdump the original data have headers like follows: ( I have deleted lines not needed to understand the problem)

dimensions:
        time = UNLIMITED ; // (1 currently)
        lat = 4320 ;
        lon = 8640 ;
variables:
        int time(time) ;
                time:standard_name = "time" ;
...
        float lat(lat) ;
                lat:standard_name = "latitude" ;
...
        float lon(lon) ;
                lon:standard_name = "longitude" ;
                lon:units = "degrees_east" ;
lon:reference_datum = "geographical coordinates, WGS84 projection" ;
                lon:grid_mapping = "Equidistant Cylindrical" ;
                lon:axis = "X" ;
                lon:valid_min = -180. ;
                lon:valid_max = 180. ;

ferret can open these files correctly, plots look fine. Listing the coordinates gives the same values like ncdump.

Now I restrict the data to highest quality level. Just to show the problem, I write output of one time step only and do not define any region. yes? let sst = if PATHFINDER_QUALITY_LEVEL eq 7 then SEA_SURFACE_TEMPERATURE else 1/0
yes? set mem/size=500
yes? save/clobber/file=test.nc/outtype=float sst

ncdump reveals, that ferret has added two points to the zonal coordinate. As usual, the modulo - attribute was set, which should be fine here.
dimensions:
        LON1_8642 = 8642 ;
        LAT = 4320 ;
        TIME = UNLIMITED ; // (1 currently)
variables:
        float LON1_8642(LON1_8642) ;
                LON1_8642:units = "degrees_east" ;
                LON1_8642:axis = "X" ;
                LON1_8642:modulo = 360.f ;
                LON1_8642:point_spacing = "even" ;
                LON1_8642:standard_name = "longitude" ;

However, something is really wrong.
yes? use test.nc
*** NOTE: Ignored modulo length exceeding axis length: LON1_8642

yes? sh data
     currently SET data sets:
    1> ./test.nc  (default)
name title I J K L M N SST IF PATHFINDER_QUALITY_LEVEL EQ 1:8642 1:4320 ... 1:1 ... ...

Inspecting the longitudes, ferret has mapped the 8640 values onto 8642 points.

ferret v6.67 produces the following header and correct coordinates.

dimensions:
        LON = 8640 ;
        LAT = 4320 ;
        TIME = UNLIMITED ; // (1 currently)
variables:
        double LON(LON) ;
                LON:units = "degrees_east" ;
                LON:axis = "X" ;
                LON:modulo = 360. ;
                LON:point_spacing = "even" ;
But it is not a good alternative, since it takes much much longer than with version 7.1.

A possible workaround could be
yes? set axis/modulo `SEA_SURFACE_TEMPERATURE,r=xaxis`
yes? let sst = if PATHFINDER_QUALITY_LEVEL eq 7 then SEA_SURFACE_TEMPERATURE else 1/0
yes? save/clobber/file=test.nc/outtype=float sst

The header is now correct:
netcdf test {
dimensions:
        LON = 8640 ;
        LAT = 4320 ;
        TIME = UNLIMITED ; // (1 currently)
variables:
        float LON(LON) ;
                LON:units = "degrees_east" ;
                LON:axis = "X" ;
                LON:modulo = " " ;
                LON:point_spacing = "even" ;
                LON:standard_name = "longitude" ;

But the file is explosive:

yes? use test.nc
yes? list x[gx=sst]
             VARIABLE : X
                        axis LON
             FILENAME : test.nc
             SUBSET   : 8642 points (LONGITUDE)
At line 330 of file tm_fmt.F
Fortran runtime error: Bad real number in item 1 of list input

Seems that 8642 coordinate values have been written anyway.

So, recent ferret versions seem to make errors, when working with this data set.

Best,
Martin Schmidt

PS: The following workaround does the job. But ferret should be more friendly to global coordinates.

yes? define axis/x=-180:180:`1/24`/edges/unit=degrees_east xax
yes? save/clobber/file=test.nc/outtype=float sst[gx=xax@asn]









[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement