Hi Hella
-
Well, here's what it is. By default, Ferret renames variables and
axes to their upper-case spelling.
Your file uses lowercase names. If you use ncdump -c to look at the
coordinates after appending the new variable to it, there are two Y
axes: the original one called lat, with coordinates that are
reversed relative to the default ordering,
lat = 87.8638, 85.09653, 82.31291, ...
and an upper-cased version called LAT, which Ferret wrote out on the
APPEND command, which is not reversed.
LAT = -87.8638000488281, -85.0965270996094,
-82.3129119873047, ...
Then when you open up that file, the variables have different
versions of the axis, one marked reversed and the other not. This
is the first time I'm aware of that the up-casing of names really
gets us into trouble.
For your files, you will want to put in this command, at the start
of your script
CANCEL MODE upcase_output
It would probably be a good idea to have this in your .ferret
startup file, so that it is always issued. With that in place
> cp orig.nc test.nc
> ferret
NOAA/PMEL TMAP
FERRET v6.64
Linux(gfortran) 2.6.9-89.0.20.ELsmp - 09/20/10
26-Oct-10 15:38
yes? use test.nc
*** NOTE: If no missing_value or _FillValue attribute on
variables, will use NaN
yes? CANCEL MODE upcase_output
yes? let testvar = q[L=1:2]
yes? save/append/file=test.nc testvar
LISTing to file test.nc
**TMAP ERR: Requested data range is outside of data set
limits
Expected: testvar[J= 1 : 64 ]
Found: testvar[J= 64 : 127 ]
Now, this is an outright error message, not a warning. It will force
you to first write to a file, and then append to that. The output
of Ferret will always be a non-reversed axis. Ferret don't have
code to write reversed axes and reversed data to netCDF files.
Ansley
On 10/26/2010 3:08 PM, Hella Riede wrote:
Hi Ansley,
alright - sounds good to me. I am curious about what's going on
and there is a whole lot of people working with those
reverse-order files. For sure EMAC and ECHAM people, maybe even
ECMWF, as this is where ECHAM was derived from.
Best wishes,
Hella
------------------------------------------------------------------------
*Subject:* Re: [ferret_users] grid problem y axis (latitude)
*Sent:* 2010-10-26 11:13:14 -0700
*From:* Ansley Manke <Ansley.B.Manke@xxxxxxxx>
*To:* Hella Riede <hella.riede@xxxxxxx>
Hi,
Thank you for the example file. I'll look into this and we can
report back to the List when we understand what's happening.
Ansley
On 10/26/2010 10:58 AM, Hella Riede wrote:
Hi Ansley,
When Ferret detects an axis with
reversed coordinates, it checks to see if they're regularly
spaced, and if so reverses them.
There is probably more to it as latitude in our case is NOT
regularly spaced (Gaussian grid) and is still reversed.
Note that if Ferret writes a
reverse-ordered variable to a new netCDF file (with the SAVE
command), the coordinates and data in the output file will
be in monotonically increasing coordinate order-reversed
from the input file.
This is true. If I create a new file as you suggest (saving a
part of the original file to new.nc and then appending to
new.nc), the file looks fine and consistent with a latitude
axis in ascending order. But I would like to append something
to the original (reversed-order) file with all its variables.
NOTE that when I try to create an
example where I append to the input file which has a
reversed axis, I get an error message and cannot do the
append.
This is exactly what I would expect: 1) issue an error message
or 2) take the reverse order also into account when appending
so the file is still consistent. I do NOT get any error
message. Instead, ferret quietly appends and I end up with a
file mirrored in latitude. Try the following with the attached
file (orig.nc):
> cp orig.nc test.nc
> ferret
yes? use test.nc !(i,j,k,l; including specific humidity q)
yes? let testvar = q[l=1:2]
yes? save/append/file="test.nc" testvar
yes? quit
=> There is no error appending to the open file with
reversed axis!
> ferret
yes? use orig.nc
yes? shade/i=1/l=1 q
yes? use test.nc
yes? set win 2
yes? shade/i=1/l=1 q
yes? set win 3
yes? shade/i=1/l=1 testvar
=> The newly appended variable "testvar" looks fine -
exactly like "q" in orig.nc. But the variable "q" in test.nc
now contains the mirror image of "q" in orig.nc!
By now I have updated to ferret version 6.64 and still get no
note or error message when loading a file with or appending to
the reverse-order axis. Any help on this behavior is
appreciated.
Thanks a lot in advance,
HellA
On 10/25/2010 6:30 AM, Hella Riede
wrote:
Hi Ansley,
Hi helle,I'm working off-line and
can't see your image, but I know the issue. What are the
units of the latitude axis?
Units of latitude axis from ncdump (original file):
float lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
What is the range of the y
coordinate values?
From "show grid" (original file):
LAT LATITUDE 64 i 87.863S
87.863N
As mentioned in my first email, this is already strange as
the values inside start start +87.863 (which should be
north) and end at -87.863 (which should be south). Here
are the start and end values of an "ncdump -v lat":
lat = 87.8638, 85.09653, 82.31291, 79.5256, 76.7369,...
-76.7369, -79.5256, -82.31291, -85.09653, -87.8638 ;
Is this a netCDF file? If so then
looking at the y-axis information from a ncdump -c.
would tell us if there's more that ferret could do to
issue a note or something.
Yes, it is a netCDF file and the header information and
values of "lat" are already provided above. Is there
anything else you need from the "ncdump -c"?
Kind regards,
Hella
To use the dataset with reversed
coordinates, the USE/ORDER qualifier let's you tell
ferret to reverse the Y axis.
Ansley
-----Original message-----
From: Hella Riede <hella.riede@xxxxxxx>
To: ferret <oar.pmel.ferret_users@xxxxxxxx>
Sent: Thu, Oct 21, 2010 14:47:37 GMT+00:00
Subject: [ferret_users] grid problem y axis (latitude)
Dear ferreters,
in our default model output, the y axis (latitude) is
unconventionallydefined from north to south. Working
with the unchanged file in ferretseems to work fine. But
since ferret does not recognize thisunconventional
axis/grid correctly, it produces a mirror image of
thedata with respect to latitude when for example
appending a variable tothe file. This "mirroring"
happens without error notice or warning,which can of
course lead to misunderstandings interpreting the data.
I prepared an example, see attachment.
Thank you in advance for taking notice.
Best wishes,
Hella
|