Re: Corner Limit in polar stereographic projection

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 7 Jul 2009 15:04:45 -0600 (MDT)

Yann,

Using the special polar plotting script (by calling gsn_csm_map_polar
directly or by setting gsnPolar to "NH" or "SH") is meant more for
looking directly at the south or north pole. The only map limits you
can change are mpMin/MaxLatF to change the lat limits.

It sounds like you don't want this, as you are setting up your
projection to view a certain rectangular area.

I would recommend not setting res_at_gsnPolar, and, if you want the
circular boundary, set:

   res_at_mpEllipticalBoundary = True

I tried this with your script, and got a *very* narrow strip plot.
This is because you are selecting a very wide longitude width
(238) but then a very small latitude height (2.9)

You may want to revisit the values you are using for the two corners.

Here's the test script I used, given the resources you listed below:

   load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
   load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

   wks = gsn_open_wks("x11","map")

   res = True
   res_at_mpCenterLonF = 180
   res_at_mpRightCornerLonF = 215.9594
   res_at_mpRightCornerLatF = -22.03884
   res_at_mpLeftCornerLonF = 38.3541
   res_at_mpLeftCornerLatF = -24.93765
   res_at_mpLimitMode = "Corners"
   res_at_mpFillOn = False
   res_at_mpEllipticalBoundary = True

   map = gsn_csm_map(wks,res)

--Mary

On Tue, 7 Jul 2009, Yann MICHEL wrote:

>
> Dear NCL talk,
>
> I have some problem in zooming into a polar stereographic projection over
> Southern Hemisphere by specifying a "Corner" Limit. I read an array of binary
> data in native AMPS grid, then read a auxiliary netcdf file to retrieve
> latitude and longitude. I then use the function /gsn_csm_contour_map_polar/
> with "opts" options where I set up mpLimitMode to be Corners and mp
> Right/Left Corner Lat/Lon F to be the values at the corners of the netcdf
> file. I got a message of warning:MapSetTrans: map limits invalid - using
> maximal area such that I've done something wrong and I need your help to
> solve it!
> My check is that mpLeftCornerLonF < mpRightCornerLonF, and that
> mpLeftCornerLatF and mpRightCornerLatF look correct, so I don't know...
> Many thanks!
>
> Yann MICHEL
>
> Description of opts:
>
> Variable: opts
> Type: logical
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> Number Of Attributes: 19
> mpCenterLonF : 180
> mpRightCornerLonF : 215.9594
> mpRightCornerLatF : -22.03884
> mpLeftCornerLonF : 38.3541
> mpLeftCornerLatF : -24.93765
> mpLimitMode : Corners
> sfYArray : <ARRAY of 63291 elements>
> sfXArray : <ARRAY of 63291 elements>
> mpFillOn : False
> gsnPolar : SH
> mpProjection : Stereographic
> cnLinesOn : True
> cnFillOn : False
> cnLevelSelectionMode : ExplicitLevels
> cnLevels : ( 0.01, 0.05, 0.2, 0.5, 0.8 )
> gsnDraw : False
> gsnFrame : False
> gsnMaximize : True
> gsnContourLineThicknessesScale : 1
> (0) True
> warning:MapSetTrans: map limits invalid - using maximal area
>
> Script:
> ; ----------------------------------------------*
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;------------------------------------------------
> begin
> ;------------------------------------------------
> ; read in data
> ;------------------------------------------------ works="ps" ; open a
> ps file
> domain = "d01"
> type="tau"
> region = "ampsrt_"+domain
> dir = "/ptmp/yann/data/ampsrt/Oct2008_NL"+domain+"/working/"
> N_imp = 25
> ;----------------------------------------------------------------------------
> ; control_variables_3d=(/"psi","chi_u","t_u","rh", "ps_u"/)
>
> control_variables_3d=(/"ps_u"/)
> Nb_vars=dimsizes(control_variables_3d)
> ;----------------------------------------------------------------------------
> wks = gsn_open_wks (works,"impulse_recf_"+region+"_"+type) ; open
> workstation
> res = True ; plot mods desired res_at_cnFillOn
> = False ; fill contour intervals
> res_at_cnLevelSelectionMode = "ExplicitLevels"
> res_at_cnLevels=(/10^(-2),0.05,0.2,0.5,0.8/)
> res_at_gsnDraw = False ; (a) donnot draw
> res_at_gsnFrame = False ; (b) donnot advance 'frame'
> res_at_gsnMaximize = True
> res_at_gsnContourLineThicknessesScale = 1.0 ; thickness
>
> ; create map from a given Netcdf auxiliary file
> nc_file =
> addfile("/ptmp/yann/data/ampsrt/rc/2009052400/wrfinput_"+domain+".nc","r")
> lat = nc_file->XLAT(0,:,:)
> lon = nc_file->XLONG(0,:,:)
> print("netcdf size")
> print(dimsizes(lat))
> print(dimsizes(lon))
> ;----------------------------------------------------------------------------
> do kvar=0,Nb_vars-1
> filename =
> dir+control_variables_3d(kvar)+"/impulse_response_"+type+"_"+control_variables_3d(kvar)+".dat"
>
> do l = 0, N_imp-1
> dim = fbinrecread (filename,2*l,4,"integer")
> ii = dim(0)
> jj = dim(1)
> ni = dim(2)
> nj = dim(3)
> print("test function at "+ii+","+jj+" size "+ni+" "+nj)
> test_function = fbinrecread (filename, 2*l+1, (/nj,ni/),"double")
> opts = res
> opts_at_cnLinesOn = True ; contour lines
> opts_at_mpProjection = "Stereographic"
> opts_at_gsnPolar = "SH"
> ; opts_at_mpEllipticalBoundary = True
> opts_at_mpFillOn = False
> opts_at_sfXArray = lon
> opts_at_sfYArray = lat
>
> opts_at_mpLimitMode = "Corners" ; choose map limits
> y1 = 0
> x1 = 0
> y2 = dim(3)-1
> x2 = dim(2)-1
> opts_at_mpLeftCornerLatF = lat(y1,x1)
> opts_at_mpLeftCornerLonF = lon(y1,x1)
> opts_at_mpRightCornerLatF = lat(y2,x2)
> opts_at_mpRightCornerLonF = lon(y2,x2)
> if ( opts_at_mpRightCornerLonF .lt. 0.0 ) then
> opts_at_mpRightCornerLonF = opts_at_mpRightCornerLonF + 360.0
> end if
> opts_at_mpCenterLonF = 180.0
> opts_at_mpGeophysicalLineColor = "black"
> opts_at_mpGridLineColor = "black"
>
> opts_at_cnLineLabelsOn = True
> opts_at_cnLineLabelFontQuality="High"
> opts_at_cnLineLabelPlacementMode="Computed"
> opts_at_cnLineLabelDensityF=0.6 opts_at_sfDataArray =
> test_function
>
> plot = gsn_csm_contour_map_polar(wks,test_function,opts) ; create plot
> draw(plot)
> frame(wks)
> end do
> end do
> end
> ;----------------------------------------------------------------------------
>
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 07 2009 - 15:04:45 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 08 2009 - 14:48:16 MDT