! bn_vec_curv.jnl
!
! vector plots with curvilinear coordinates
!
! ACM  10/23/01 
!       9/12/02  vary the lengths of the vectors in 1st two plots.
! ACM 4/2005 set mode meta to save one of the plots for the metafile checks.
!            and cancel mode logo, so that .plt files are comparable.

set mode meta vec_curv.plt
can mode logo
use coads_climatology
set reg/l=1
go mp_orthographic 230 60
set grid sst
go mp_aspect

let yy =  if abs(y[gt=sst]) le 20 then 10 else  (100-abs(y[gt=sst]+1))/ 10.

vec/noax/xskip=6/yskip=6/len=20/title="View From Space"  sst*0,(sst*0+yy)*mp_mask, x_page,y_page
vec/over/xskip=6/yskip=6/len=20 (sst*0+yy)*mp_mask,sst*0, x_page,y_page
vec/over/xskip=6/yskip=6/color=blue/len=20  (sst*0+yy)*mp_mask,(sst*0+yy)*mp_mask, x_page,y_page

can mode meta

! Sinusoidal projection; put data at the poles

use coads_climatology
go mp_sinusoidal
set grid sst
go mp_aspect

let fsst = missing(sst,5)
let yy =  if abs(y[gt=sst]) le 20 then 10 else  (100-abs(y[gt=sst]+1))/ 10.

set reg/l=1
vec/noax/xskip=16/yskip=8/len=15/title="Sinusoidal Projection" fsst*0,fsst*0+yy*mp_mask, x_page,y_page
vec/over/xskip=16/yskip=8/len=15 fsst*0+yy*mp_mask,fsst*0, x_page,y_page

! Irregular axes, and manual axis scaling
set win/asp=1
set mode meta vec_curv2.plt

def axis/from_data/x/name=xirr {0,1,2,4,6,7,8,10,14,16,20,23,24}
def axis/from_data/y/name=yirr {0,2,4,5,6,7,8,9,12,13,14,15,18}
let a = 0.1*x[gx=xirr] + 4*y[gy=yirr]
let b = 3*x[gx=xirr] + y[gy=yirr]
set view ul
vec a,b

! project it to a regular grid
let mx = i[i=1:13]
let my = j[j=1:13]
let mxpage = mx + 0*my
let mypage = my+0*mx
set view ll
vec/title="Regular grid" a,b,mxpage,mypage

! Now stretch the grid

set view lr
let mx = exp(x[x=2:4.4:0.2])
let my = exp(y[y=1:3.4:0.2])

let mxpage = mx + 0*my
let mypage = my + 0*mx
vec/title="Stretched grid" a,b,mxpage,mypage

can mode meta
set mode logo
