[ncl-talk] gsn_csm_contour_map() Lambert Projection West Shift Problem
LSL
lslrsgis at whu.edu.cn
Tue May 7 02:54:41 MDT 2019
Dear NCL Community,
I am using gsn_csm_contour_map() to map a pesudo matrix. Corresponding
Lambert Projection parameters (cen_lon=105) are set for _/China
region/_. However, the map cover shifts ~90 deg west, strange!
The result map and script is attached. Any indication is appreciated. Thank!
LSL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190507/13c7ecee/attachment.html>
-------------- next part --------------
; Julia 4/11/2013: this script loads in the yearly data files and extracts the daily data from these files and then assigns these values in a probability density function. The pdf of the model and observatio are then compared to produce a perkins skill score at each grid point. These are then plotted on a contour.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;load "/scratch/y98/shared/ncl-functions/cordex_grid_plot_functions.ncl"
begin
;---------------INPUTS-------------------------------------
x = 62
y = 91
domain = "d01"
; -------- now extract the vairables we need
;get a landmask and some other stuff from a wrfout file
; load a wrfout file to get land-mask info out
f = addfile("/home/lsl/Downloads/DATA/wrfout_2015/Processed/wrfout_" + domain + ".nc","r")
landmask = wrf_user_getvar(f,"LANDMASK",0)
;dsizes_array = dimsizes(land_mask)
; also get some map info for later on
truelat1 = f at TRUELAT1
truelat2 = f at TRUELAT2
cen_lon = f at CEN_LON
cen_lat = f at CEN_LAT
wrf_lat2d = f->XLAT(0,:,:)
wrf_lon2d = f->XLONG(0,:,:)
latr = wrf_lat2d
lonr = wrf_lon2d
;mask water and remove relaxation zone
dsizes_array = dimsizes(landmask)
print(dsizes_array)
landmask_nr = landmask(0:(dsizes_array(0)-1),0:(dsizes_array(1)-1))
lon = lonr(0:(dsizes_array(0)-1),0:(dsizes_array(1)-1))
lat = latr(0:(dsizes_array(0)-1),0:(dsizes_array(1)-1))
dsizes_landmask_nr = dimsizes(landmask_nr)
print(dsizes_landmask_nr)
nlat = dsizes_landmask_nr(0)
nlon = dsizes_landmask_nr(1)
; convert lon to be 0->360 not -180->180
lon = where(lon.lt.0,360.+lon,lon)
;*******Draw Panel Plots************
type= "png"
wks_ppt = gsn_open_wks(type,"./PLOT_TEST/pkss_ppt_test_" + domain)
gsn_define_colormap(wks_ppt,"BlGrYeOrReVi200")
res = True
res at mpProjection = "LambertConformal"
res at mpLambertParallel1F = 25.0
res at mpLambertParallel2F = 47.0
res at mpLambertMeridianF = 105.0
res at mpOutlineDrawOrder = "PostDraw" ; force map tp be drawn 1st
res at mpGridLineDashPattern = 2 ; lat/lon lines as dashed
res at mpPerimOn = True
res at mpPerimDrawOrder = "PostDraw"
res at mpOutlineOn = True
res at mpGridAndLimbOn = True
res at mpGridSpacingF = 10.
res at pmTickMarkDisplayMode = "Always"
res at tmXTLabelsOn = False
res at tmYRLabelsOn = False
res at mpOutlineBoundarySets = "National"
res at mpGeophysicalLineThicknessF = 1.5
res at mpDataBaseVersion = "MediumRes"
res at mpDataSetName = "Earth..4"
res at mpOutlineSpecifiers = (/"China:states"/)
res at mpFillOn = True
;;some more basic plot aspects
res at cnLinesOn = False ; no lines on contour plot
res at cnFillOn = True ; fill map with color
res at cnLineLabelsOn = False ; no line label
res at gsnSpreadColors = True ; use full spread of color-bar
res at mpGridLatSpacingF = 10 ; grid line spacing on plot
res at mpGridLonSpacingF = 10
res at pmTickMarkDisplayMode = "Always" ; display tick marks
res at tmXTLabelsOn = False ; turn off tick-marks labels at top of plot
res at tmYRLabelsOn = False ; trun off tick-marks labels at right of plot
res at tmXTOn = False ; turn off top tick marks
res at tmYROn = False; turn off right tick marks
res at tmXBOn = False
res at tmXTOn = False
;res at mpLimitMode = "Corners"
;res at mpLeftCornerLatF = lat(0,0)
;res at mpLeftCornerLonF = lon(0,0)
;res at mpRightCornerLatF = lat(nlat-1,nlon-1)
;res at mpRightCornerLonF = lon(nlat-1,nlon-1)
;print(lat(0,0))
;print(lon(0,0))
;print(lat(nlat-1,nlon-1))
;print(lon(nlat-1,nlon-1))
; define label bar properties
res at lbLabelBarOn = False ; Turn off label bar for individual plot, NOTE: set this to true if you are trying to figure out the scale
; set colorbar manually
res at cnLevelSelectionMode = "ManualLevels"
res at cnMinLevelValF = 0.025
res at cnMaxLevelValF = 0.275
res at cnLevelSpacingF = 0.025
dumpmatrix = generate_2d_array(20,20,-1.0,0.834,0,(/62,91/))
plot1 = gsn_csm_contour_map(wks_ppt,dumpmatrix,res)
end
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pkss_ppt_test_d01.png
Type: image/png
Size: 182961 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190507/13c7ecee/attachment.png>
More information about the ncl-talk
mailing list