Re: set my boundary of my map according to my data and color map

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 7 Jan 2008 11:17:33 -0700 (MST)

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
Received on Mon Jan 07 2008 - 11:17:33 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 07 2008 - 11:19:46 MST