
! Description: demonstrate the production of polar stereographic projections

! *acm* 7/01 update /pen=  to /color=/thickness=

! *** Note: this demo is superseded by newer map projection  *** !
! *** capabilities introduced in Ferret Version 5.0 see      *** !
! *** "map projections" in Users Guide, and                  *** !
! ***                                                        *** !
! ***  yes? go mp_demo                                       *** !
! ***                                                        *** !

! This demo will display the same plot twice: first with a standard
! latitude/longitude rectangular "projection" and again using a polar
! stereographic projection.   The demo plots are based on COADS data
! and include these features:

! 1) An SST field as a color-filled contour background
! 2) The continents in solid-filled gray at 40 minute resolution
! 3) The outline of the continents overlaid (for sharpness)
! 4) Vectors of surface wind speed overlaid in red
! 5) Contours of air temperature as an overlay
! 6) A series of CTD cast locations plotted as overlaid symbols

message

! **** set up data sets and variables for the demo  ****
set data coads_climatology
cancel region/x
set region/l=1
set region/y=0:90
! define fake variables as make-pretend CTD cast data
let/quiet ctd_casts_lon = if i[i=1:40] LT 20 then 140+3*i[i=1:40] else 200 
let/quiet ctd_casts_lat = if i[i=1:40] LT 20 then  25 else 1.5*i[i=1:40]-5 

! ****************************************************************
! **** First plot: on standard latitude/longitude coordinates ****
set window 1
set window/aspect=.6/size=.5
fill/lev=(-2,30,2)/title="SST, winds, and AIRT"/pal=no_red sst
go fland 60 gray
go land
vector/color=red/overlay uwnd,vwnd
contour/color=black/levels=(-5,30,5)/overlay airt
plot/vs/overlay/nolabels/symbols ctd_casts_lon,ctd_casts_lat


! ****************************************************************
! **** Next: the same plot using a polar stereographic projection *** 

! Note that the commands are very similar to the previous plot
!     (The rotation angle of 100 degrees is as per NMC conventions)
! Note, also, that the speed of the polar output depends on the resolution
!	that is requested.  This example uses the default of 201x201.
!	The resolution is an optional argument which may follow the "100"
!	in the "go polar_2d" and "go polar_vector" commands.
message
set window 2
set wind/aspect=1:ax/size=.5
go polar_2d fill/lev=(-2,30,2)/title="SST, winds and AIRT"/pal=no_red sst 100
go polar_fland 60 gray
go polar_land " " 1.0       ! limit lines to a radius of 1
go polar_vector vector/color=red/overlay uwnd,vwnd 100
go polar_2d contour/color=black/levels=(-5,30,5)/overlay airt 100 
go polar_vs plot/vs/overlay/nolabels/symbols ctd_casts_lon,ctd_casts_lat

! a little extra: put a curved "graticule" onto the plot
go polar_grid_fancy
