[Thread Prev][Thread Next][Index]

[ferret_users] Re: [ferret_users] 20° E seems to be magic



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


2017-01-27 11:51 GMT+00:00 baris onol <onolba@xxxxxxxxxx>:
how about this one?

yes? shade/l=1/x=-20:40/y=-60:0/over 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)


On 01/27/2017 02:09 PM, Martin Schmidt wrote:
Dear ferreters,

I had to compile my pyferret by myself, so I am not sure if the subsequent bug is a general one.

ferret
        NOAA/PMEL TMAP
        PyFERRET v7 (opt)
        Linux 3.19.0-64-generic - 07/01/16

yes? use coads_climatology
yes? fill/l=1/grat/x=-20:40/y=-60:0 sst
yes? shade/over /lev=(100)/pal=grey missing(sst[l=1],100)

In my figure the land west of 20°E remains white.

The result for
yes? fill/l=1/grat/x=340:400/y=-60:0 sst
yes? shade/over /lev=(100)/pal=grey missing(sst[l=1],100)
is complementary.

I find also non-filled points in the function fill_xy near 20°E, where information on adjacent ocean points seems to be "blocked" at 20°E. This looks like if the same error is behind the scene, but in the above example the problem is most obvious.

Setting a region before calling the plot commands, everything is fine for this example:
yes? set region/x=-20:40/y=-60:0
yes? fill/l=1/grat sst
yes? shade/over /lev=(100)/pal=grey missing(sst[l=1],100)

But with fill_xy there is still one point not filled at 20°E.

Seems that 20°E is still a magic boundary?

So my question: For safe code, should it generally avoided to specify regions withing the plot commands? Is there another idea to get safe code.

Best,
Martin





--
----------------------------------------------------
Nicolas Freychet
PDRA, School of Geosciences
University of Edinburgh
----------------------------------------------------



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

Privacy Policy | Disclaimer | Accessibility Statement