[Thread Prev][Thread Next][Index]

Re: bug in mp_graticule



Hi Jaison,
Thanks for the suggestion to replace REPEAT/K= with
REPEAT/RANGE in the mp_graticule scripts. This is just
the kind of thing that REPEAT/RANGE was introduced to
address.  We'll do that before the next Ferret release.

Ansley Manke

Jaison Kurian wrote:

Hi Muyin,
To make stereographic plots we need to "set grid my_variable" &
this will load the information about abstract axis "K" of the variable along
with other axis. In mp_graticule.jnl (ferret/go dir.) one repeat loop is defined as "repeat/k=2:5". So when we use a variable with the size of abstract
axis "K" as 1 (as in your case [Z=1]) Ferret will complain that the size of abstract axis "K" set by the "set grid my_variable" is 1 ..so any value of "k"
greater than 1 ( set by the `k` in DEFINE VARIABLE/quiet mp_xaxdel = mp_xdel/`k`;
inside the repeat loop) is not possible. You can get rid of this problem as described below.
NOTE : I think the repeat loops in the go files (provided with Ferret 5.6 and 5.7) can be changed to REPEAT/RANGE to avoid this kind of problems.
Method.1 --------
If your Ferret version is 5.6 or 5.7 use "REPEAT/RANGE=2:5" instead of "REPEAT/k=2:5" in mp_graticule.jnl (ferret/go dir.). So you need to
change line 137 from
repeat/k=2:5 (if `mp_xaxdel gt 1` then let/quiet mp_xaxdel = mp_xdel/`k`)
to
repeat/range=2:5 (if `mp_xaxdel gt 1` then let/quiet mp_xaxdel = mp_xdel/`repcount`) To know more about REPEAT/RANGE plese see http://ferret.pmel.noaa.gov/Ferret/Documentation/Release_Notes/v56.html#repeat_range
In this case you can use "[Z=1]" variable as it is without any problem.

Method.2
--------
If your Ferret version is older one (and if you don't wamt to upgrade it )
then you can remove the information about "K" or rather "Z" axis from the variable since it does have only one value over this axis. Define a dummy variable with same X-Y grid as the variable then use "RESHAPE" function to wrap the variable to this X-Y grid. let xy_stamp = x[gx=myvar]*0 + y[gy=myvar]*0
let myvar_xy = RESHAPE(my_var,xy_stamp)

Then use this new variable in "set grid". Please note that you can use
either the new variable or the old one itself in the "SHADE" or "FILL"
command since the "set grid" loads the information about the abstract
axes.

Before saving the variable[Z=1] to a file also you can use the RESHAPE function
(variable[Z=1:1@ave] will remove the information about "Z" axis).

Example (method.2)
---------------------
! Let us make some dummy data defined as over [Z=1] to work with
!
use levitus_climatology
let temp_extr = temp[z=1] !!!! let temp_extr = temp[z=1:1@ave]
! will remove the "Z axis" ! you can do the "Z axis removal" using "reshape" also..
! let let xy_stamp = x[gx=temp]*0 + y[gy=temp]*0
! let temp_ex = RESHAPE(temp_extr,xy_stamp) ! save/file=temp_extr.nc/append temp_extr

save/file=temp_extr.nc/append temp_extr
cancel data 1 ; cancel var/all
set data temp_extr.nc
! if Z axis exits ..remove it now
let xy_stamp = x[gx=temp_extr]*0 + y[gy=temp_extr]*0 let temp_ex = RESHAPE(temp_extr,xy_stamp)
set grid temp_ex set region/x=0:360/y=00:90
go mp_stereographic_north
shade/lev=(-5,30,2) temp_ex, x_page, y_page ! or shade/lev=(-5,30,2) temp_extr, x_page, y_page
go my_mp_graticule 0 360 30 0 90 15
go mp_fland 120 black
Hope This helps

With Regards

Jaison

On Tue, 28 Sep 2004, Muyin Wang wrote:


Hi, Ansley:
I am trying to use stereographic_north projection to do some contour
plots. When the plot is done, I'd like to add "mp_graticule" to the plot.
However, the mp_graticule works for 3D data or 2D data, but not the ones I
extracted of a 2D data with z=1 dimension from a 3D data set.
The error message looks like this:

**ERROR: illegal limits: "K" is not in the range K=2
         Axis extremes are K=1
DEFINE VARIABLE/quiet mp_xaxdel = mp_xdel/`k`
Command file, command group, or REPEAT execution aborted

Is there a way to work around this?
Thanks,
Muyin






[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement