Dear Mary
Thanks a lot. Following your suggestion I could solve all my problems
See I got the attached figures.
But why there is no boundary for each state in the figure?
See my script:
do v = 0,dimsizes(var)-1
x = f->$var(v)$
printVarSummary(x)
x_at_lat2d=lat_long->LAT(0,0,:,:)
x_at_lon2d=lat_long->LON(0,0,:,:)
dims=dimsizes(x_at_lat2d)
nlat=dims(0)
nlon=dims(1)
wks = gsn_open_wks("ps"
,year+"JJA.aver"+var(v:v)) ;
gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select
color map
res = True ; plot mods desired
res_at_gsnMaximize = True
res_at_gsnSpreadColors = True ; use
full range of colormap
res_at_cnFillOn = True ; color plot desired
res_at_cnLinesOn = False ; turn off
contour lines
res_at_cnLineLabelsOn = False ; turn
off contour labels
res_at_tiXAxisString = "Longitude"
res_at_tiYAxisString = "Latitude"
res_at_lbOrientation = "Vertical" ; Move labelbar
res_at_mpProjection = "LambertConformal"
res_at_mpLambertParallel1F = 30.
res_at_mpLambertParallel2F = 60.
res_at_mpLambertMeridianF = -92.
res_at_tfDoNDCOverlay = True
lat2dmatrix=x_at_lat2d
lon2dmatrix=x_at_lon2d
res_at_mpLimitMode = "Corners"
res_at_mpLeftCornerLatF = lat2dmatrix(0,0)
res_at_mpLeftCornerLonF = lon2dmatrix(0,0)
res_at_mpRightCornerLatF = lat2dmatrix(nlat-1,nlon-1)
res_at_mpRightCornerLonF = lon2dmatrix(nlat-1,nlon-1)
;************************************************
; Turn on lat / lon labeling
;************************************************
res_at_pmTickMarkDisplayMode = "Always" ; turn
on tickmarks
res_at_tmXTOn = False ; turn off top labels
res_at_tmYROn = False ; turn off right labels
res_at_tiMainFuncCode = "~"
plot = gsn_csm_contour_map(wks,x(0,0,:,:),res)
end do
Thanks
Xiaoming
Mary Haley wrote:
>
> On Sat, 5 Jan 2008, Xiaoming Hu wrote:
>
>> Dear all
>>
>> See the plot I draw in the attachment, the map is bigger than my
>> data. How could I set the map to fit my data exactly? Also the color
>> map is the one I
>
> Dear Xiaoming,
>
> I think you want to use the mpLeftCornerLatF, mpLeftCornerLonF,
> mpRightCornerLatF, mpRightCornerLonF resources, instead of
> the mpMinLatF, mpMinLonF, mpMaxLatF, mpMaxLonF resources:
>
> dims = dimsizes(x_at_lat2d)
> nlat = dims(1)
> nlon = dims(2)
> res_at_mpLeftCornerLatF = x_at_lat2d(0,0)
> res_at_mpLeftCornerLonF = x_at_lon2d(0,0)
> res_at_mpRightCornerLatF = x_at_lat2d(nlat-1,nlon-1)
> res_at_mpRightCornerLonF = x_at_lon2d(nlat-1,nlon-1)
>
> You may also want to consider using a different map projection, like
> Lambert Conformal. See example 1 at:
>
> http://www.ncl.ucar.edu/Applications/wrflc.shtml
>
>> usually used for my WRF post-processing, why it didn't show well in
>> this case? I mean I could only see blue in the map.
>
> I think this is because only the first few colors in your color map
> are getting used. Try setting:
>
> res_at_gsnSpreadColors = True ; use full range of
> colormap
>
> in order to tell gsn_csm_contour_map to use the full range of your
> colormap. You will see this resource being set in the example I
> pointed you to above.
>
> --Mary
>
>> see my script:
>> note that the latitude and longitude information is in a seperate
>> CMAQ output file(GRIDCRO2D_20010828.nc)
>> begin
>> print("begin")
>> var =
>> (/"RN","RC","RADYNI","RBNDYI","RSTOMI","HFX","QFX","MOLI","WSPD10","WDIR10"/)
>>
>> years = (/2001,2002,2051,2052/)
>> lat_long =
>> addfile("/gpfs_share/jhuang5/CMAQ_runs/inp_PNNL/met/GRIDCRO2D_20010828.nc","r")
>>
>> do iyr = 0,dimsizes(years)-1
>> year = years(iyr:iyr)
>> f =
>> addfile("METCRO2D_"+year+"JJA.extracted.nc.aver.nc","r")
>>
>> do v = 0,dimsizes(var)-1
>> x = f->$var(v)$
>> printVarSummary(x)
>> ; printVarSummary(lat_long->LAT)
>> x_at_lat2d=lat_long->LAT(0,0,:,:)
>> x_at_lon2d=lat_long->LON(0,0,:,:)
>> printVarSummary(x)
>> print(x!0)
>> print(x!1)
>> print(x!2)
>> print(x!3)
>> x_at_coordinates= "XLONG XLAT"
>> ; print(dimsizes(x&COL))
>> ; print(dimsizes(x&ROW))
>> wks = gsn_open_wks("ps" ,year+"JJA.aver"+var(v:v)) ;
>> gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ;
>> select color map
>> res = True ; plot mods
>> desired
>> res_at_cnFillOn = True ; color plot
>> desired
>> res_at_cnLinesOn = False ; turn off
>> contour lines
>> res_at_cnLineLabelsOn = False ; turn
>> off contour labels
>> res_at_tiXAxisString = "Longitude"
>> res_at_tiYAxisString = "Latitude"
>> res_at_lbOrientation = "Vertical" ; Move labelbar
>> res_at_mpMinLonF = min(x_at_lon2d)
>> res_at_mpMaxLonF = max(x_at_lon2d)
>> res_at_mpMinLatF = min(x_at_lat2d)
>> res_at_mpMaxLatF = max(x_at_lat2d)
>>
>> ;************************************************
>> ; Turn on lat / lon labeling
>> ;************************************************
>> res_at_pmTickMarkDisplayMode = "Always" ; turn
>> on tickmarks
>> res_at_tmXTOn = False ; turn off top labels
>> res_at_tmYROn = False ; turn off right labels
>> res_at_tiMainFuncCode = "~"
>> plot =
>> gsn_csm_contour_map(wks,x(0,0,:,:),res)
>> system ("convert "+year+"JJA.aver"+var(v:v)+".ps
>> "+year+"JJA.aver"+var(v:v)+".jpg")
>> system ("rm "+year+"JJA.aver"+var(v:v)+".ps")
>>
>> end do
>>
>> end do ; iyr
>> end
>>
>>
>> Thanks
>>
>> Xiaoming
>>
>>
>>
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.2.0 : Tue Jan 08 2008 - 18:39:18 MST