Hi Martin,
Thank you for the examples. This lack of modulo-ing on the
overlay is not new behavior, but I agree it is surprising.
For the first SHADE command, Ferret reads the data and uses the
/X= -20:40 to trigger a modulo data operation to get that data,
then draw the plot box and make the plot. For the overlay, it
reads all of sst[l=1], and overlays
that on the existing plot. There isn't enough in that command to
get it to do the modulo operation.
A good way to ensure that the data you really want is loaded, is
to give the context in square brackets on the variable
specification, such as missing(sst[l=1,x=-20:40,y=-60:0],100).
That tells Ferret what data to load for that variable, as it's
getting the data for the _expression_. The global SET REGION
context also gives us the right result in this case, but it can be
too strong a limitation in some cases. Here's a discussion of setting
the context.
Also, here's a plot sequence you might look at, using a SHADE and
then FILL/OVER to make sure all of the white space is filled in.
yes? use coads_climatology
yes? shade/l=1 sst[l=1,x=-20:40,y=-60:0]
yes? fill/over/lev sst[l=1,x=-20:40,y=-60:0]
yes? shade/over /lev=(100)/pal=grey
missing(sst[l=1,x=-20:40,y=-60:0],100)
It's not as smooth as doing a FILL on a FILL_XY result, but it
can be a good general technique.
-Ansley
On 1/27/2017 7:38 AM, Martin Schmidt
wrote:
Hi all, thank for the suggestions!
Seems to be a Pandoran box. But step by step ...
The following does not work:
ferret
yes? use coads_climatology
yes? shade/l=1/x=-20:40/y=-60:0 sst
yes? shade/over/lev=(100)/pal=grey missing(sst[l=1],100)
:-(
Try to use another specification of coordinates:
ferret
yes? use coads_climatology
yes? shade/l=1/x=20W:40E/y=60S:0N sst
yes? shade/over/lev=(100)/pal=grey missing(sst[l=1],100)
)-:
OK, lets say it explicitly
ferret
yes? use coads_climatology
yes? shade/l=1/x=-20:40/y=-60:0/grat sst
yes? shade/over/lev=(100)/pal=grey/x=-20:40/y=-60:0
missing(sst[l=1],100)
Much better. Is it eventuall the "missing" function?
ferret
yes? use coads_climatology
yes? shade/l=1/x=-20:40/y=-60:0/grat sst
yes? shade/over/pal=bluescale sst[l=1]*10
Definitely not, it is most probably the missing coordinate
specification in the overlay.
What tells ncdump:
double COADSX(COADSX) ;
COADSX:units = "degrees_east" ;
COADSX:modulo = " " ;
COADSX:point_spacing = "even" ;
COADSX = 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45,
47, 49, 51, 53,
.....
373, 375, 377, 379 ;
Hm, 20°E is really a special point, but the axis is modulo.
Lets have graticule now
ferret
yes? use coads_climatology
yes? shade/l=1/x=-20:40/y=-60:0/grat sst
yes? shade/over/lev=(100)/pal=grey/x=-20:40/y=-60:0
missing(sst[l=1],100)
Excellent. Perfect for scientific work. But not for others
purposes...
Remeber in "fill" to gain fake accuracy:
ferret
yes? use coads_climatology
yes? fill/l=1/x=-20:40/y=-60:0/grat sst
yes? shade/over/lev=(100)/pal=grey/x=-20:40/y=-60:0
missing(sst[l=1],100)
Smoother, but the white spots are still disturbing. So fill them
with "shade" first and overlay with "fill":
yes? use coads_climatology
yes? shade/l=1/x=-20:40/y=-60:0 sst
yes? fill/l=1/x=-20.5:40.5/y=-60:0/over sst
yes? shade/over/lev=(100)/pal=grey/x=-20:40/y=-60:0
missing(sst[l=1],100)
This does the same
yes? use coads_climatology
yes? set region/x=-20:40/y=-60:0
yes? shade/l=1 sst
yes? fill/l=1/over sst
yes? shade/over/lev=(100)/pal=grey missing(sst[l=1],100)
Now we try to add graticule:
yes? use coads_climatology
yes? set region/x=-20:40/y=-60:0
yes? shade/l=1/grat sst
yes? fill/l=1/over/grat sst
yes? shade/over/lev=(100)/pal=grey/grat missing(sst[l=1],100)
Land is filled correctly, but the graticule is mostly lost. It
may be redrawn using a second viewport, or with explicit lines.
But lets search for a simpler solution.
Extend the ocean into land with the nearest neighbour filler
fill_xy before using "fill" It calculates the average over all
valid nearest neighbour points. This can be done repeatedly. A
smooth and limited extrapolation.
yes? use coads_climatology
yes? set region/x=-20:40/y=-60:0
yes? let mask=0*missing(sst[l=1],1)+1 ! Nothing to be excluded
yes? fill/l=1/grat fill_xy(sst,mask,1)
yes? shade/over /lev=(100)/pal=grey missing(sst[l=1],100)
Filling one point seems not to satisfy the "fill" function near
corners.
Nothing to be discussed, just call two sequences in fill_xy to
fill land two points inward:
ferret
yes? use coads_climatology
yes? set region/x=-20:40/y=-60:0
yes? let mask=0*missing(sst[l=1],1)+1
yes? fill/l=1/grat fill_xy(sst,mask,2) !Note the "2"
yes? shade/over /lev=(100)/pal=grey missing(sst[l=1],100)
There is one leftover white point that should not be there. I
have inspected the details, just by plotting fields before and
after filling. fill_xy does not fill the one point in the first
sequence, again at 20°E. There is a similar point located in the
Mediterranean, again at 20°E. So fill_xy gives wrong results at
two ocean points.
Wanting just an image, fill three time with fill_xy(sst,mask,3).
Thats it.
Anyway, it is disturbing to know that a tool gives a wrong
result, even if this happens solely at two points in a 360x180
grid. In summery, some problems show up in overlay plots, but
also without plotting in some functions things may go wrong. And
it is generally related to the cut longitude at 20°E.
Is there a way to get a correct result with ferret? Yes, it can!
yes? use coads_climatology
yes? set region/x=-20:40/y=-60:0
yes? let mask=0*missing(sst,2)+1
yes? fill/l=1/grat
fill_xy(sst[l=1,x=-20:40,y=-60:0],mask[x=-20:40,y=-60:0],2)
yes? shade/over /lev=(100)/pal=grey missing(sst[l=1],100)
I did not check coordinates of land carefully, simple checks
look fine considering we have a 2deg data set.
All commands used here should give correct results, but some do
not. But I cannot propose a general rule to produce safe
scripts.
May be, I have missed a point specific for modulo axes?
Have a nice weekend and happy ferreting,
Martin
01/27/2017 01:24 PM, Nicolas Freychet wrote:
Hi Martin,
Did you try to use explicitly "20E" instead of "-20"?
fill/l=1/grat/x=20E:40W/y=60S:0N sst
Also, try to do a simple "go land 1" after you filled your
figure, to see if the continents are placed correctly
according to the lon/lat (if not, then it may be a problem
of coordinates in your data)
Cheers,
Nicolas
|