[ncl-talk] add string on each domain
LI Qi
liqi123sh at qq.com
Thu Apr 2 02:26:30 MDT 2015
Dear Rick,
Really appreciate your help! It works!
Attached is my script to add domain idx.
But I still have a minor question: when the minimum contour level of terrain height (unit: m) is set to 0, the ocean area shows green. Only when set to 2, the ocean displays correctly (shown below). Why?
The terrain data is output from WRF model.
Best regards,
Qi
ncl script:
xbox = (/lon2(0,0),lon2(0,nx2),lon2(ny2,nx2),lon2(ny2,0),lon2(0,0)/)
ybox = (/lat2(0,0),lat2(0,nx2),lat2(ny2,nx2),lat2(ny2,0),lat2(0,0)/)
datatondc(map, xbox, ybox, xbox_out, ybox_out)
gsn_polyline_ndc(wks, xbox_out, ybox_out, lnres)
; domain 2 idx
gsn_text_ndc(wks, "d02" , xbox_out(3), ybox_out(3), txres)
------------------ Original ------------------
From: "Rick Brownrigg";<brownrig at ucar.edu>;
Date: Thu, Apr 2, 2015 00:47 AM
To: "LI Qi"<liqi123sh at qq.com>;
Cc: "ncl-talk"<ncl-talk at ucar.edu>;
Subject: Re: [ncl-talk] add string on each domain
Hi,
There's probably a couple of ways to do this. gsn_add_text allows you to add and position text in the coordinate space of the data:
http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_text.shtml
In the example script you referenced, you'd want to make this call before the call to "draw(map)" for plot 3.
Alternatively, you can position the text in normalized-device-coordinate space (NDC-space) using gsn_text_ndc():
http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_text_ndc.shtml
Look in particular at how the nested domain's outline was drawn *on top of* plot3 using NDC coordinates:
; PLOT 3 draw(map) ; domain 2 already overlaid here - so just draw again xbox = (/lon2(0,0),lon2(0,nx2),lon2(ny2,nx2),lon2(ny2,0),lon2(0,0)/) ybox = (/lat2(0,0),lat2(0,nx2),lat2(ny2,nx2),lat2(ny2,0),lat2(0,0)/) datatondc(map, xbox, ybox, xbox_out, ybox_out) gsn_polyline_ndc(wks, xbox_out, ybox_out, lnres)
Hope that helps...
Rick
On Tue, Mar 31, 2015 at 8:35 PM, LI Qi <liqi123sh at qq.com> wrote:
Hello NCL community,
I was wondering how to add strings like d01 and d02 in the top-left corner of each domain separately.
The plot of nested domains is shown below.
( http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/EXPERIMENTAL/wrf_overlay_doms.htm )
_______________________________________________
ncl-talk mailing list
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/20150402/6fba4682/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 279677 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150402/6fba4682/attachment-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 291528 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150402/6fba4682/attachment-0003.obj
More information about the ncl-talk
mailing list