[Thread Prev][Thread Next][Index]

Re: [ferret_users] regarding go poly_swath



Hi Saurabh,

The plot_swath script isn't taking into account the fact that the z axis is a depth axis, or positive-downwards.  This will be fixed in upcoming Ferret releases (and sooner on the GitHub Ferret repository).  The corrected script is attached.

Or, in the meantime you could add /TRANSPOSE to the polygon command that you pass to the script,

   go plot_swath poly/ov/pal=grey_light/nolab/nokey/trans  ...

For your second example, the ERROR message is cropping up because even though you average over Y and your plot variables are in Z only, the grid of the variables is still seen as having a Y-axis dependency.  This is related to what is discussed in the third example at the start of the plot_swath script, where it suggests specifying the region on the variable.  The averaging operation doesn't allow us to do it this way, so I think you will need to be explicit in putting your variables onto a Z-only grid,

   let zvar = z[gz=slope]
   let var1 = reshape(slope1-(2*tig1), zvar)
   let var2 = reshape(slope1+(2*tig1), zvar)
   go plot_swath poly/ov/pal=grey_light/nolab/nokey/trans var1, var2  


-Ansley

On 3/20/2017 8:16 PM, saurabh rathore wrote:
Dear Ferreters

I am facing a problem for using the go ploy_swath command for my data which is having variable as slope in depth and latitude. I calculated slope from go regresst. I am attaching my data file and i am sharing my script. after running the file for_slope_en.jnl for file slope_en.nc there is an error.

go plot_swath poly/ov/pal=grey_light/nolab/nokey slope1-(2*tig1), slope1+(2*tig1)
 **ERROR: inconsistent sizes of data regions: can't label Y axis of PSWX
poly/ov/pal=grey_light/nolab/nokey/coord_ax=Y  PSWx4_0,PSWy4_0
Command file, command group, or REPEAT execution aborted

But after taking the @ave on y axis and saving the variable in slope1.nc and running the file for_slope1.jnl, there is no error but the go poly_swath function is also not working.

please suggest me what should i do to get the ploy_swath command to work.

Attached files are the data files and their respective scripts file.

Any help will be highly appreciated.

regards, saurabh

--


REGARDS

Saurabh Rathore
Research Scholar (PhD.)
Centre For Oceans, Rivers, Atmosphere & Land Science Technology
Indian Institute Of Technology, Kharagpur
contact :- 91- 8345984434

\cancel mode verify
! plot_swath.jnl
! 6/99 *sh*
! 1/02 *acm* add note on limits
! 3/17 *acm* handle positive-down Z axis

! Description: Plot a color-filed swath between upper and lower bounds

! Usage:                    $1         $2  $3   $4
! yes?	GO plot_swath polygon_command ylo yhi [xpts] 
! $1 - the plot command with qualifiers (eg POLYGON/OVER/KEY)
! $2 - upper bound variable
! $3 - lower bound variable
! $4 - x coordinates (shared by both of the following arguments)
!    - default is the values of t the underlying axis of argment 2 

! Note:
!     The variables a and b must be 1-dimensional.  If they have axes
!     that are normal to the axis of interest, then limits on those axes
!     must be explicit in the expressions passed in arguments 2 and 3, 
!     even if the range on that axis is a single point.  See example 3.

! example 1 - difference between two points on a grid
!	yes? use coads_climatology
!	yes? let a = sst[y=0,l=1,x=20e:20e]
!	yes? let b = sst[y=10n,l=1,x=20e:20e]
!	yes? plot a,b
!	yes? go plot_swath poly/over/nolabels/palette=black  a b

! example 2 -- 3 colored time series
!	yes? let base =  T[T=1-jan-1990:1-feb-1990:24] - T[T=1-jan-1990]
!	yes? let y1 = base^0.5
!	yes? let y2 = base
!	yes? let y3 = base^1.1
!	yes? let y4 = base^1.2
!	
!	yes? plot/nolabels y1,y2,y3,y4
!	yes? go plot_swath poly/over/nolabels/palette=red   y1,y2
!	yes? go plot_swath poly/over/nolabels/palette=green y2,y3
!	yes? go plot_swath poly/over/nolabels/palette=blue  y3,y4
!
! example 3 -- 2 time series with 1-point z axis.
!	yes? define axis/T=1-jan-1990:1-feb-1990:24] timeax
!	yes? define axis/z=1:1:1 zax
!	yes? define grid/z=zax/t=timeax ztgrid
!	yes? let tpts = t[gt=ztgrid] - T[T=1-jan-1990]
!	yes? let zpts = z[gz=ztgrid]
!	yes? let a1 = tpts + zpts
!	yes? let a2 = a1 + 100*sin(tpts/100)
!	yes? plot/nolabels a1,a2
!       yes? !  note we need to pass explicit Z limits even for a 1-point axis.
!	yes? go plot_swath poly/over/nolabels/palette=red (a1[k=1]), (a2[k=1])
!
! argument check
QUERY/IGNORE $1"<usage: yes? GO plot_swath polygon_command ylo yhi [xpts]"
QUERY/IGNORE $2"<usage: yes? GO plot_swath polygon_command ylo yhi [xpts]"
QUERY/IGNORE $3"<usage: yes? GO plot_swath polygon_command ylo yhi [xpts]"

! save the input expressions into simple variable definitions
LET/QUIET PSWylo = ($2)
LET/QUIET PSWyhi = ($3)

! determine the orientation of the data (and check that it is 1D)
DEFINE SYMBOL PSWax `PSWylo,return=shape`
DEFINE SYMBOL PSWquad_ax ($PSWax"|X>Z|Y>Z|Z>Y|T>Z|<error: data is not a line")
DEFINE SYMBOL PSWiax ($PSWax"|X>i|Y>j|Z>k|T>l")

! get the dependent coordinates -- needed since POLYGON is like PLOT/VS
! typically, "0*PSWylo + X[i=lo:hi]", so X is inherited from PSWylo
IF $4"0|*>1" THEN
   LET/QUIET PSWx = $4
ELSE
  DEFINE SYMBOL PSWilo `PSWylo,return=($PSWiax)start`
  DEFINE SYMBOL PSWihi `PSWylo,return=($PSWiax)end`
  LET/QUIET PSWx_raw =  0*PSWylo + ($PSWax)
  LET/QUIET PSWx = PSWx_raw[($PSWiax)=($PSWilo):($PSWihi)]
ENDIF

! break swath into a sequence of discrete quadralaterals
LET/QUIET PSWpindex = ($PSWquad_ax)[($PSWquad_ax)=1:4]
LET/QUIET PSWx4_0 = IF PSWpindex EQ 1 OR PSWpindex EQ 4 then PSWx ELSE PSWx[($PSWax)=@shf:1]
LET/QUIET PSWy4_1 = IF PSWpindex LE 2 then PSWylo ELSE PSWyhi
LET/QUIET PSWy4_0 = IF PSWpindex EQ 1 OR PSWpindex EQ 4 then PSWy4_1 ELSE PSWy4_1[($PSWax)=@shf:1]

! If the plot is in the Z direction and it is a depth axis, need /TRANS
IF ($PSWax"|Z>1|*>0") THEN 
   IF `PSWx4_0,return=isDepth` THEN DEFINE SYMBOL flip = /TRANS
ENDIF

$1($flip)/coord_ax=($PSWquad_ax)  PSWx4_0,PSWy4_0

cancel symbol PSW*
cancel variable PSW*
set mode/last verify

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

Privacy Policy | Disclaimer | Accessibility Statement