Bug - issue with res@mpMaxLonF and res@mpMinLonF at branch cut (180 degrees E)

From: Don Stark <stark_at_nyahnyahspammersnyahnyah>
Date: Sun, 13 Apr 2008 09:53:41 -0600

1. % ncl -V5.0.0
2. This example follows from the raster pop example. See code
attached at the end of this email. The issue is that the declarations
for res_at_mpMaxLonF and res_at_mpMinLonF fail at the branch cut. It plots
correctly when res_at_mpMinLonF > 180, but fails when res_at_mpMinLonF =<
180. This is independent of whether the units are degrees east
(-180:180) or just degrees (0:360). In the current example the
longitude units are degrees.

3. file too large, should be independent of specific file.
4. See two images below. The good has res_at_mpMinLonF = 180.1. the bad
has res_at_mpMinLonF = 179.1
5. No error message
6. mac OSX 10.4 on a G4

--
---------------------------------------------------------------
Don Stark, PhD                          stark_at_ucar.edu
NCAR, Boulder CO
303.497.2472
---------------------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;*****************************************************
begin
  f1 = addfile("out_gx1v4_to_NEP4_Wcurtain_bilin_da_080407.nc","r")
; convert pop grid from radioans to degrees
  scale = 180.0/3.1415927
  src_lat2d  = f1->src_grid_center_lat*scale      ; extract 2D grid
  src_lon2d  = f1->src_grid_center_lon*scale
   dims      = dimsizes(src_lon2d)       ; get dimension sizes
   dims(1)   = dims(1) + 1               ; increase longitude by 1
   nlat      = dims(0)
   nlon      = dims(1)
    lon2d     = new(dims,typeof(src_lon2d)) ; create new arrays
   lat2d     = new(dims,typeof(src_lat2d))
   lat2d(:,1:nlon-1)  = src_lat2d      ; fill in arrays
   lon2d(:,1:nlon-1)  = src_lon2d
   lon2d(:,0)         = src_lon2d(:,nlon-2)
   lat2d(:,0)         = src_lat2d(:,nlon-2)
   lat2d_at_units        = "degreeN"
   lon2d_at_units        = "degrees"
; Source variables
  src_array = f1->src_array(1:nlat-1,:)   ; POP array
  f = src_array
   f_at_lat2d   = lat2d
   f_at_lon2d   = lon2d
;=================================================;
; Create plot
;=================================================;
   wks  = gsn_open_wks("ps","popgrid")             ; open a ps file
   gsn_define_colormap(wks,"BlAqGrYeOrRe")         ; choose colormap
   res                      = True                 ; plot mods desired
   res_at_cnFillOn             = True                 ; turn on color fill
   res_at_cnFillMode           = "RasterFill"         ; turn on raster mode
   res_at_cnLinesOn            = False                ; turn off contour  
lines
   res_at_gsnSpreadColors      = True                 ; use full colormap
   res_at_gsnSpreadColorStart  = 10                   ; start at color 10
   res_at_gsnSpreadColorEnd    = 96                   ; end at color 96
; zoom in on map
   res_at_mpMaxLatF            = max( lat2d(250:350,160:265) )
   res_at_mpMinLatF            = min( lat2d(250:350,160:265) )
   res_at_mpMaxLonF            = 267.9
   res_at_mpMinLonF            = 180.1
   plot = gsn_csm_contour_map_ce(wks,f,res)
   end



_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

good.jpg bad.jpg
Received on Sun Apr 13 2008 - 09:53:41 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 15 2008 - 19:45:52 MDT