[ncl-talk] How to move main title to upper left

Mary Haley haley at ucar.edu
Tue May 16 10:13:55 MDT 2017


Hi Jake,

The wrf_xxxx plotting scripts are really meant to be used in a "black box"
sense, in that they specifically put text in locations such that you get an
image that roughly covers an 8.5 x 11  page.

If you want to place custom strings around the plot, I suggest using
gsn_text_ndc, where you use NDC coordinates (0.0 to 1.0) to specify the
location of the text strings.  You can use the drawNDCGrid(wks) procedure
to help you determine what NDC coordinates to use.

See example text_20.ncl at:

http://www.ncl.ucar.edu/Applications/text.shtml#ex20

--Mary


On Tue, May 16, 2017 at 12:50 AM, Jacob Alberto Garcia <
jacob_garcia at dlsu.edu.ph> wrote:

> Hi I have this plot as show below and I want to do the following
> modification
>
>
>> Also I want to make the “Output from Geogrid 3.8.1…. EW…Dis” Thicker and
> place it in the lower left corner.
>
> This is the code I am using
>
> ============================================================
> ===========================
>
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> ;load "./WRFUserARW.ncl"
>
> begin
> ;
> ; The WRF ARW input file.
> ; This needs to have a ".nc" appended, so just do it.
>   a = addfile("geo.nc","r")
>
> info     = (/ " 1  Urban",                             \  ; n=0
>                 " 2  Dryland Cropland & Pasture ",     \
>                 " 3  Irrigated Cropland & Pasture",    \
>                 " 5  Cropland/Grassland Mosaic ",      \
>                 " 6 Cropland/Woodland Mosaic       ",  \
>                 " 7  Grassland   ",                    \
>                 " 11  Deciduoud Broadleaf    ",        \
>                 " 13  Evergreen Broadleaf      ",      \
>                 " 15  Mixed Forest          ",         \
>                 "16 Water Bodies          ",           \
>                 "19 Parks and Cemeteries  ",           \
>                 "31  Low Intensity Residential          ", \
>                 "32  High Instensity Residential  ", \
>                 "33  Commercial and Industrial    " /) ; n = 14
>
>   ninfo    = dimsizes(info)
>
>
> ; We generate plots, but what kind do we prefer?
>   ;type = "x11"
>  type = "pdf"
> ; type = "ps"
> ; type = "ncgm"
>   wks = gsn_open_wks(type,"LU")
>    color = (/ "purple" , "red", "lemonchiffon", "khaki4", "lawngreen",
> "coral4", "darkgreen", "darkolivegreen1", "darkolivegreen2", "maroon2",\
>              "cyan1", "blue", "black", "yellow", "darkgreen"/)
>
> ; Purple here is for the NA/0/ Missing value. No need to place it below in
> cnLevels ;since there are no missing values
>
>
> ; Set some Basic Plot options
>   res = True
>   res at MainTitle                   = "Land Use Index Reclassified MMEIRS"
>   res at Footer = True
>   res at tiMainPosition = "Left"
>
>
> pltres                            = True
> mpres                             = True
> res = True
> res at ValidTime = False
> res at InitTime = False
> mpres at mpGridAndLimbOn = False
> mpres at mpGeophysicalLineColor      = "Black"
> mpres at mpNationalLineColor         = "Black"
> mpres at mpUSStateLineColor          = "Black"
> mpres at mpGridLineColor             = "Black"
> mpres at mpLimbLineColor             = "Black"
> mpres at mpPerimLineColor            = "Black"
> mpres at mpGeophysicalLineThicknessF = 1
> mpres at mpDataBaseVersion           = "HighRes"
> mpres at mpDataResolution            = "FinestResolution"
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ; What times and how many time steps are in the data set?
>   times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
>   ntimes = dimsizes(times)         ; number of times in the file
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>     res at TimeLabel = times(0)    ; Set Valid time to use on plots
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
>
>
> ;For Zooming in
>
> lat2d = wrf_user_getvar(a,"XLAT_V",0)
> lon2d = wrf_user_getvar(a,"XLONG_V",0)
>
>
> ; LANDUSE ,
>
>   opts = res
>   opts at sfXArray = lon2d                      ; these 2 are for setting
> sfXArray/sfYArray
>   opts at sfYArray = lat2d
>
>   opts at cnRasterModeOn = True
>   opts at cnFillOn         = True               ; color Fill
>   opts at cnFillMode       = "RasterFill"
>   opts at cnLinesOn        =  False             ; Turn off contour lines
>   opts at cnLevelSelectionMode = "ExplicitLevels" ; set explict contour
> levels
>   opts at cnLevels         =  (/1,2,3,5,6,7,11,13,15,16,19,31,32,33/)
>   opts at cnFillPalette    = color        ; distinct colors for categories
>   opts at gsnSpreadColors  = False              ; use each color sequentially
>
>
>
>   rtxt = True
>   rtxt at txJust        = "TopLeft"
>   rtxt at txFontHeightF = 0.01
>
>   res at vpHeightF      = 0.475
>   res at vpWidthF       = 0.475
>
>
> nrow = 3       ; # rows
>   ncol = 6      ; # columns
>
>   n  = -1        ; counter
>   xx = 0.012     ; iterate to get right
>   do nc=0,ncol-1
>      yy = 0.20   ; 0.065
>     do nr=0,nrow-1
>        n = n+1
>        if (n.le.(ninfo-1)) then    ; handle less than ninfo
>            gsn_text_ndc (wks,info(n),xx,yy,rtxt)
>            yy = yy - 2*rtxt at txFontHeightF
>        end if
>     end do
>      xx = xx + 0.200    ; iterate to get right
>   end do
>
>   if(isfilevar(a,"LU_INDEX"))
>         land = wrf_user_getvar(a,"LU_INDEX",0)
>         contour = wrf_contour(a,wks,land,opts)
>
>         mpres at mpLimitMode = "Corners"
>         mpres at mpLeftCornerLatF = 14.3
>         mpres at mpLeftCornerLonF = 120.8
>         mpres at mpRightCornerLatF = 14.9
>         mpres at mpRightCornerLonF = 121.3
>
>         pltres at LatLonOverlay = True
>
>
>         plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)
>       end if
>
>
>   ;draw(plot) Dont draw plot just frame the WKS
>   frame(wks)
>
>
>       delete(opts)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> end
>
> ============================================================
> ===========================
>
>
>
> Hoping you guys could help
>
>
> Thanks,
>
> Jake
>
> <http://www.dlsu.edu.ph> <https://www.facebook.com/DLSU.Manila.100>
> <http://instagram.com/dlsu> <https://twitter.com/dlsumanila>
> <http://dlsumanila.tumblr.com/> <http://iblog.lasalle.ph/>
>
> DISCLAIMER AND CONFIDENTIALITY NOTICE
> The information contained in this e-mail, including those in its
> attachments, is confidential and intended only for the person(s) or
> entity(ies) to which it is addressed. If you are not an intended recipient,
> you must not read, copy, store, disclose, distribute this message, or act
> in reliance upon the information contained in it. If you received this
> e-mail in error, please contact the sender and delete the material from any
> computer or system. Any views expressed in this message are those of the
> individual sender and may not necessarily reflect the views of De La Salle
> University.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170516/d397e7c8/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2017-05-16 at 2.45.58 PM.png
Type: image/png
Size: 211569 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170516/d397e7c8/attachment-0001.png 


More information about the ncl-talk mailing list