NAM Domain outlined inside the GFS domain. |
Lets first start by opening the files, and gathering our relevant information!
'sdfopen http://nomads.ncep.noaa.gov:9090/dods/gfs_hd/gfs_hd20130618/gfs_hd_00z'
'set mpdset hires'
set display color white'
'clear'
'set clevs 100000'
'd capesfc'
'sdfopen http://nomads.ncep.noaa.gov:9090/dods/nam/nam20130618/nam_00z'
'set dfile 2'
'q file'
dimslin=sublin(result,5)
xmax=subwrd(dimslin,3)
ymax=subwrd(dimslin,6)
This code first opens the GFS (parent file) and then displays a dummy variable so that we have a map and a scaled environment. It then opens the NAM (nested file) and gathers the number of x and y grid-points in the domain. This is important, as we can make use of this data to help set our boundaries.
The simplest way to draw the domain of a nested grid is to take the lower left and the upper right corners of your domain, and draw a rectangle around them. We will set the nested model to encompass its entire domain and then, by using the 'q dims' and the 'q w2xy' commands, we will convert the lat/lon coordinates to page coordinates and draw our box.
'set x 1 'xmax
'set y 1 'ymax
'q dims'
xline=sublin(result,2)
yline=sublin(result,3)
lonmin=subwrd(xline,6)
lonmax=subwrd(xline,8)
latmin=subwrd(yline,6)
latmax=subwrd(yline,8)
lonmin=lonmin+360
lonmax=lonmax+360
*Bottom Left Corner
'q w2xy 'lonmin' 'latmin
x1=subwrd(result,3)
y1=subwrd(result,6)
*Top Right Corner
'q w2xy 'lonmax' 'latmax
x2=subwrd(result,3)
y2=subwrd(result,6)
What we did here, was just get the minimum lat/lon coordinate, and the maximum lat/lon coordinate and convert them to page coordinates using the 'q w2xy' command. Note: the longitude values had to be added to 360 to account for the differences between the two domains. Then we saved each value. Now, the last thing we need to do is draw the rectangle. This is done by simply inputting the bottom left and top right corners into the 'draw rec' command.
'set line 1'
'set cthick 6'
'draw rec 'x1' 'y1' 'x2' 'y2
I added a couple of commands to make the line thicker and black, but now you have your nested domain boundaries plotted in your parent grid (see image above).
Download Example Script Here
Hi,
ReplyDeleteI have a time of series, is possible the q w2xy?.
What?
Un example, please