<div dir="ltr"><div><div>Hi,<br><br></div>I don't know for certain what is going on there, but I suspect those labels are not inherently wrong given the apparent projection, but perhaps just not what you wanted. It would be interesting to know the values of<br><br> opts@mpLeftCornerLatF = lat2d(0,0)<br>
opts@mpLeftCornerLonF = lon2d(0,0)<br>
opts@mpRightCornerLatF = lat2d(nlat-1,mlon-1)<br>
opts@mpRightCornerLonF = lon2d(nlat-1,mlon-1)<br>
<br>
opts@mpCenterLonF = f1@CEN_LON<br>
; opts@mpCenterLatF = f1@CEN_LAT<br>
opts@mpCenterLatF = 90. ; This is necessary to fix<br>
the wrong value on the WRF file.<br><br><br>It may be that for the mpCenterLatF to the pole is the issue. Also, temporarily setting this resource to True may help explain what projection is like:<br></div><div>
<br> opts@mpGridAndLimbOn = False ; turn on lat/lon lines<br><br></div><div>Hope that helps some...<br></div><div>Rick<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 12, 2016 at 1:20 AM, <span dir="ltr"><<a href="mailto:am@bio.mie-u.ac.jp" target="_blank">am@bio.mie-u.ac.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello NCL users,<br>
<br>
I am having a problem with plotting figures on polar stereographic<br>
projection.<br>
<br>
The labels on left, right and top sides of the figures seem somewhat<br>
strange. They all show longitude. I expect the labels on left and right<br>
show latitude as <a href="http://www.ncl.ucar.edu/Applications/wrfpo.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/wrfpo.shtml</a>. Would<br>
you please give me suggestions on my script attached below? If you need<br>
more information, please let me know. Thank you very much.<br>
<br>
$ uname -a<br>
Linux <a href="http://aofd165.bio.mie-u.ac.jp" rel="noreferrer" target="_blank">aofd165.bio.mie-u.ac.jp</a> 2.6.18-398.el5 #1 SMP Tue Sep 16 20:50:52<br>
EDT 2014 x86_64 x86_64 x86_64 GNU/Linux<br>
<br>
$ cat /etc/redhat-release<br>
CentOS release 5.11 (Final)<br>
<br>
$ ncl -V<br>
6.3.0<br>
<br>
<br>
$ <a href="http://ncl.run.sh" rel="noreferrer" target="_blank">ncl.run.sh</a><br>
1st Argument (script name) =h_sst.ncl<br>
2nd Argument (runname) =PL1101_00.02<br>
3rd Argument (domain) =d02<br>
4th Argument (nc_file) =wrfout_d02_2011-01-18_00:00:<a href="http://00.nc" rel="noreferrer" target="_blank">0<wbr>0.nc</a><br>
5th Argument (indir) =../../../../WRF.Result/<br>
6th Argument (nn) =0<br>
<br>
Input file: ../../../../WRF.Result/PL1101_<wbr>00.02/WRF_PL1101_00.02/<br>
wrfout_d02_2011-01-18_00:00:<a href="http://00.nc" rel="noreferrer" target="_blank">00<wbr>.nc</a><br>
<br>
fig file = ../../../../WRF.Plots/PL1101_<wbr>00.02/PL1101_00.02_h_sst.ncl/<br>
PL1101_00.02.d02.h_sst.000<br>
warning:PlotManagerSetValues: TickMark annotation cannot be added after<br>
NhlCreate<br>
<br>
<br>
======================<br>
<a href="http://ncl.run.sh" rel="noreferrer" target="_blank">ncl.run.sh</a><br>
======================<br>
#!/bin/sh<br>
<br>
exe=./runncl.sh<br>
<br>
domain=d02<br>
<br>
#ncl="h_t2.ncl"<br>
#ncl="h_t2.polarstereo.ncl"<br>
#ncl="h_ice.ncl"<br>
ncl="h_sst.ncl"<br>
<br>
indir="../../../../WRF.Result/<wbr>"<br>
<br>
list_runname=" \<br>
PL1101_00.02 \<br>
"<br>
<br>
datetimelist="\<br>
2011-01-18_00:00:00 \<br>
"<br>
<br>
nn=0<br>
for runname in $list_runname; do<br>
<br>
for datetime in $datetimelist; do<br>
<br>
nc_file=wrfout_${domain}_${<wbr>datetime}.nc<br>
<br>
$exe $ncl "$runname" "$domain" "$nc_file" "$indir" "$nn"<br>
<br>
nn=$(expr $nn + 1)<br>
<br>
done<br>
<br>
done<br>
<br>
<br>
exit 0<br>
<br>
----------------------<br>
End of <a href="http://ncl.run.sh" rel="noreferrer" target="_blank">ncl.run.sh</a><br>
----------------------<br>
<br>
<br>
<br>
======================<br>
runncl.sh<br>
======================<br>
#!/bin/bash<br>
#<br>
# Universal wrapper script for ncl.<br>
# Pass arguments from the command line to environment variables<br>
#<br>
# version 0.1, Thierry Corti, C2SM ETH Zurich<br>
#<br>
<br>
E_BADARGS=65<br>
<br>
if [ ! -n "$1" ]<br>
then<br>
echo "Usage: `basename $0` script.ncl argument1 argument2 etc."<br>
exit $E_BADARGS<br>
fi<br>
<br>
# save number of arguments to environment variable NCL_N_ARG<br>
export NCL_N_ARGS=$#<br>
<br>
# save command line arguments to environment variable NCL_ARG_#<br>
for ((index=1; index<=$#; index++))<br>
do<br>
eval export NCL_ARG_$index=\$$index<br>
done<br>
<br>
# run ncl<br>
ncl -nQ $1<br>
<br>
----------------------<br>
End of runncl.sh<br>
----------------------<br>
<br>
<br>
<br>
======================<br>
h_sst.ncl<br>
======================<br>
load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<br>
load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/wrf/WRFUserARW.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<br>
load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/shea_util.ncl"<br>
load "./add_lc_labels.ncl"<br>
<br>
<br>
begin<br>
wallClock1 = systemfunc("date") ; retrieve wall clock time<br>
<br>
a1 = getenv("NCL_ARG_1")<br>
print("1st Argument (script name) ="+a1)<br>
runname1 = getenv("NCL_ARG_2")<br>
print("2nd Argument (runname) ="+runname1)<br>
domain = getenv("NCL_ARG_3")<br>
print("3rd Argument (domain) ="+domain)<br>
nc_file = getenv("NCL_ARG_4")<br>
print("4th Argument (nc_file) ="+nc_file)<br>
indir = getenv("NCL_ARG_5")<br>
print("5th Argument (indir) ="+indir)<br>
nn = getenv("NCL_ARG_6")<br>
print("6th Argument (nn) ="+nn)<br>
<br>
scriptname=systemfunc("<wbr>basename " + a1 + " .ncl")<br>
scriptname2=a1<br>
<br>
outdir= "../../../../WRF.Plots/" + runname1 + "/" \<br>
+ runname1 + "_" + scriptname2 + "/"<br>
<br>
command="mkdir -p " + outdir<br>
system(command)<br>
print("")<br>
<br>
infile1= indir + runname1 + "/" + "WRF_" + runname1 + "/" + nc_file<br>
print("Input file: "+ infile1)<br>
print("")<br>
<br>
;<br>
; The WRF ARW input file.<br>
; This needs to have a ".nc" appended, so just do it.<br>
f1 = addfile(infile1,"r")<br>
<br>
; Get land mask data<br>
it=0<br>
oro = wrf_user_getvar(f1,"XLAND",it)<br>
<br>
lat2d = wrf_user_getvar(f1,"XLAT",it) ; latitude<br>
lon2d = wrf_user_getvar(f1,"XLONG",it) ; longitude<br>
nlat = dimsizes(lat2d(:,0))<br>
nlon = dimsizes(lat2d(0,:))<br>
<br>
<br>
; What times and how many time steps are in the data set?<br>
times = wrf_user_getvar(f1,"times",-1) ; get all times in the file<br>
ntimes = dimsizes(times) ; number of times in the file<br>
<br>
; Check dimension<br>
it=0<br>
lh = wrf_user_getvar(f1, "LH",it)<br>
dsizes = new( (/2/),integer)<br>
dsizes = dimsizes(lh)<br>
; print(dsizes)<br>
im=dsizes(0)<br>
jm=dsizes(1)<br>
<br>
dx = f1@DX<br>
dy = f1@DY<br>
<br>
lat1=50.<br>
lat2=83.<br>
lon1=-30.<br>
lon2=32.<br>
<br>
; We generate plots, but what kind do we prefer?<br>
type = "png" ; ps x11 pdf ngcm<br>
<br>
res = True<br>
res@gsnDraw = False ; do not draw the plot<br>
res@gsnFrame = False ;-- don't advance<br>
frame<br>
res@gsnAddCyclic = False ;-- data are not<br>
global, don't add lon cyclic point<br>
<br>
; Figure size<br>
res@gsnMaximize = False ;True ; maximize plot in frame<br>
res@vpXF = 0.1<br>
res@vpYF = 1<br>
res@vpHeightF = 0.8<br>
res@vpWidthF = 0.6<br>
<br>
res@gsnDraw = False ; turn off draw and<br>
frame<br>
res@gsnFrame = False ; b/c this is an<br>
overlay plot<br>
res@pmTickMarkDisplayMode = "Always" ;-- draw nicer<br>
tickmarks<br>
res@tiMainString = runname1 ; add titles<br>
res@pmTickMarkDisplayMode = "Always" ; turn on automatic tickmarks<br>
<br>
res@tiMainString = runname1<br>
res@gsnAddCyclic = False<br>
<br>
; Plotting options<br>
opts = res<br>
opts@mpFillOn = False<br>
opts@mpDataBaseVersion = "MediumRes" ;-- choose map<br>
database<br>
opts@mpGeophysicalLineColor = "Gray" ;changes the outline line color.<br>
opts@<wbr>mpGeophysicalLineThicknessF = 1 ;changes the thickness of<br>
continental outlines.<br>
opts@gsnLeftString = ""; sst1@long_name<br>
opts@gsnRightString = times(it)<br>
opts@gsnAddCyclic = False<br>
opts@sfXArray = lon2d<br>
opts@sfYArray = lat2d<br>
opts@mpDataBaseVersion = "HighRes"<br>
<br>
dimll = dimsizes(lat2d) ; get size of dimensions<br>
nlat = dimll(0)<br>
mlon = dimll(1)<br>
<br>
opts@mpProjection = "Stereographic"<br>
opts@mpLimitMode = "Corners"<br>
opts@mpLeftCornerLatF = lat2d(0,0)<br>
opts@mpLeftCornerLonF = lon2d(0,0)<br>
opts@mpRightCornerLatF = lat2d(nlat-1,mlon-1)<br>
opts@mpRightCornerLonF = lon2d(nlat-1,mlon-1)<br>
<br>
opts@mpCenterLonF = f1@CEN_LON<br>
; opts@mpCenterLatF = f1@CEN_LAT<br>
opts@mpCenterLatF = 90. ; This is necessary to fix<br>
the wrong value on the WRF file.<br>
<br>
opts@cnFillOn = True<br>
opts@mpGridAndLimbOn = False ; turn on lat/lon lines<br>
opts@cnLevelSelectionMode = "ManualLevels" ; set manual contour<br>
levels<br>
opts@cnMinLevelValF = 0. ; set min contour level<br>
opts@cnMaxLevelValF = 14. ; set max contour<br>
level<br>
opts@cnLevelSpacingF = 1. ; set contour spacing<br>
<br>
opts2=res<br>
opts2@cnFillOn = False<br>
opts2@sfXArray = lon2d<br>
opts2@sfYArray = lat2d<br>
<br>
<br>
nt=0<br>
nstart=0 ; Time loop starts a day after the model initial time<br>
nstep=1<br>
nend=1; ntimes-1<br>
; do it = nstart, nend, nstep ; TIME LOOP<br>
<br>
it=0<br>
<br>
lh = wrf_user_getvar(f1,"LH",it) ;<br>
t2 = wrf_user_getvar(f1,"SST",it) ;<br>
t2=t2-273.15<br>
<br>
slp=wrf_user_getvar(f1,"slp",<wbr>it)<br>
<br>
figfile= outdir + runname1 + "." + domain + "." + scriptname + \<br>
"." + sprinti("%0.3i",<wbr>stringtointeger(nn))<br>
<br>
print("fig file = " + figfile )<br>
wks = gsn_open_wks(type, figfile)<br>
gsn_define_colormap(wks,"<wbr>WhBlGrYeRe")<br>
<br>
plot = gsn_csm_contour_map(wks,t2,<wbr>opts)<br>
<br>
plot2 = gsn_csm_contour(wks,slp,opts2)<br>
<br>
overlay(plot,plot2)<br>
<br>
<br>
;MAKE PLOTS<br>
draw(plot)<br>
frame(wks)<br>
<br>
; nt=nt+1<br>
; end do<br>
<br>
wallClock2 = systemfunc("date") ; retrieve wall clock time<br>
print("Started at " + wallClock1)<br>
print("Finished at " + wallClock2)<br>
<br>
end<br>
<br>
----------------------<br>
End of h_sst.ncl<br>
----------------------<br>
<br>
Atsuyoshi<br>
<br>
---<br>
Atsuyoshi Manda, PhD<br>
Mie University, Japan<br>
am at <a href="http://bio.mie-u.ac.jp" rel="noreferrer" target="_blank">bio.mie-u.ac.jp</a><br>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>