Re: Zoom-in drawing from WRF

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 11 2011 - 16:10:04 MST

All,

I provided Samuel with a way to zoom in on his plots, but it required a mod to WRFUserARW.ncl
in order to add a special "LatLonOverlay" resource and some mods to his script.

I've attached the modified WRFUserARW.ncl file to this message.

The work-around is not as simple as it could be. This is just a quick fix until we can get something
better in. Please note that we may change the way this is done, so the work-around below
may be temporary:

To use this modification, you must first retrieve the XLAT/XLONG variables off the wrf output file:

    lat2d = wrf_user_getvar(a,"XLAT",it)
    lon2d = wrf_user_getvar(a,"XLONG",it)

Before you call wrf_contour (or wrf_vector for that matter), you need to set the
sfXArray/sfYArray (vfXArray/vfYArray for vector plots) resources to the
XLONG/XLAT arrays you retrieved:

        opts_r@sfXArray = lon2d
        opts_r@sfYArray = lat2d
. . .
        contour_tot = wrf_contour(a,wks, rain_tot, opts_r)

Before you call wrf_map_overlays, set the zoom parameters that you want. For example:

  mpres@mpLimitMode = "Corners"
  mpres@mpLeftCornerLatF = 20.0
  mpres@mpLeftCornerLonF = 116.0
  mpres@mpRightCornerLatF = 26.0
  mpres@mpRightCornerLonF = 124.0

Finally, you need to set the special LatLonOverlay resource to True:

        pltres@LatLonOverlay = True ; Don't do an NDC overlay
        plot = wrf_map_overlays(a,wks,contour_tot,pltres,mpres)

--Mary

On Jan 9, 2011, at 6:21 PM, Leung Samuel wrote:

> Dear Mary,
>
> I uploaded two files, the NCL script and the WRF output data (in gz format, please gunzip it and rename it to *.nc before running the script). Please check if the files mentioned exist, as I am not able to see them after uploading.
>
> Thanks for your help!
>
> Samuel Leung
>
> On Sat, Jan 8, 2011 at 2:11 AM, Mary Haley <haley@ucar.edu> wrote:
> Hi Samuel,
>
> When you set the tfDoNDCOverlay resource to True, you are telling NCL that
> the contours should be overlaid exactly on whatever map projection you set up.
> No lat/lon information is given to indicate where the contours should be overlaid
> on the map; instead, NCL basically lines up the contour plot with the map plot as is.
>
> If you zoom in on the map, then, NCL will overlay the contours to fit the zoomed
> area, because that's what you are telling it to do when you set tfDoNDCOverlay to True.
>
> What needs to happen is to *not* set tfDoNDCOverlay to True, and to include the 2D lat/lon
> coordinates with the contour plot, so that NCL knows where to properly overlay the
> contours on the zoomed in map. This might be a bit tricky with the wrf_xxxx functions
>
> I can help with this if you can upload your script and data file to ftp.cgd.ucar.edu that would help:
>
> ftp ftp.cgd.ucar.edu
> <log in as "anonymous">
> <Use email address as password>
> cd incoming
> put <your files>
> quit
>
> I'll need to know the exact name of the files in order to retrieve them.
>
> Thanks,
>
> --Mary
>
>
> On Jan 7, 2011, at 1:11 AM, Leung Samuel wrote:
>
>> Dear NCL Team,
>>
>> I am working on extracting total precipitation data from WRF and make a plot with the help of NCL script adopted from web (http://www.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/PRECIP/wrf_Precip.htm). The script worked fine when I was about to make a full domain plot, but the problem appeared when I had a zoomed view. The contour data failed to align to the basemap lat/lon. The same problem persisted when I kept the full domain plot but I changed it to mercator projection. I guess the causes of the problems for the above behaviours are the same. Certain settings about WRF map overlays have to be done.
>>
>> I only modified a few of the NCL script from the mentioned web, except that I only made a plot on total precipitation, and I added some codes for changing the projection and lat/lon corners:
>> mpres@mpProjection = "Mercator"
>> mpres@mpDataSetName = "Earth..1"
>> mpres@mpDataBaseVersion = "HighRes" ; "Ncarg4_1"
>>
>> mpres@mpLimitMode = "Corners"
>> mpres@mpLeftCornerLatF = 20.0
>> mpres@mpLeftCornerLonF = 116.0
>> mpres@mpRightCornerLatF = 26.0
>> mpres@mpRightCornerLonF = 124.0
>>
>> mpres@tfDoNDCOverlay = True
>>
>> I would like to keep the approach of using "wrf_contour" and "wrf_map_overlays" in the NCL script. Is it possible to do that?
>>
>> Please let me know if you want to take a look at my whole script and tell me where I can upload it. Thanks a lot!
>>
>> Regards,
>> Samuel Leung
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 11 16:10:08 2011

This archive was generated by hypermail 2.1.8 : Thu Jan 13 2011 - 09:24:21 MST