Hi Helle,
Now that I see the sequence of commands you used, I see more about
what's happening. When Ferret detects an axis with reversed
coordinates, it checks to see if they're regularly spaced, and if so
reverses them. At this point it sets an internal flag marking the
axis as a reversed axis, and data from the netCDF file is read with
the reversal taken into account. This is described in the
documentation: Chapter 2, sec 2.5:
Files with reverse-ordered axes
If the coordinates of an axis are
monotonically decreasing, instead of increasing, Ferret will
transparently reverse both the axis coordinates and the
dependent variables that are defined upon that axis. 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.
If the values of a dependent variable are reversed, but there is no
associated coordinate axis then use attach a minus sign to the
corresponding axis orientation in the USE/ORDER= qualifier to
designate that the variable(s) should be reversed along the
corresponding axis.
(What is meant in the last paragraph, is that if the data values are
reversed but the coordinate axis is not reversed, or if the axis is
not in world-coordinate units, then use USE/ORDER= to tell Ferret to
reverse the data when it is read.)
Copying the commands that you showed in your PDF file here,
> cp orig.nc test.nc
> ferret
NOAA/PMEL TMAP
FERRET v6.64
Linux(gfortran) 2.6.9-89.0.20.ELsmp - 09/20/10
25-Oct-10 12:27
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
=> ferret writes whole file again, including variable
“testvar”
yes? quit
> ferret
yes? use test.nc
yes? shade/i=1/l=1 q
yes? use orig.nc
yes? set win 2
yes? shade/i=1/l=1 q
Now we have both the y axis which Ferret has reversed (internal to
Ferret), and the original axis (in test.nc or orig.nc).
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.
I *think* that if you had done everything by saving to a new file,
then the data is always written using the reversed axis
yes? use test.nc
yes? save/file=new.nc q[L=1:3]
yes? let testvar = q[L=1:2]
yes? save/append/file=new.nc testvar
And the two variables q and testvar in this new file would both be
correct. Is that the case??
Another note: when you save testvar = q[L=1:2], it'll save the
full time range of data, because the variable has the same grid as
the original data. But only timesteps 1 and 2 will have valid data.
Ansley
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
|