Re: Wrfout wind profiler scripting

From: Tardif, Elliot M <elliot.tardif_at_nyahnyahspammersnyahnyah>
Date: Wed Sep 21 2011 - 12:26:28 MDT

Good afternoon Adam,

Thanks very much to you and your colleagues for your help in figuring this out! I have tested this script using additional data files on my end, and I'm happy to report it works successfully! There were a couple of hours, however, where there were data that exceeded 5000 feet, which resulted in wind barbs being plotted out of the top of the graph. I was able to solve this problem by inserting an if statement around the draw command, so that it would plot so long as the height was less than 5000 feet, which was the "ymax" variable in the script. That section of the script now appears as follows:

     do hh = 0,dimsizes(z)-1
        if (z(hh).lt.ymax) then
        wmsetp("col", GetFillColorIndex(contours,colors,wspd(hh))) ; Draw in red.
        wmbarb(wks, gg*1., z(hh), u(hh), v(hh))
        end if
     end do

Finally, I was wondering if it was possible to apply something similar to the "res@vcMinDistanceF" to the plot? This particular command won't work in a csm_xy plot environment, and I would like to thin out a few of the wind vectors especially at lower levels so it is easier to read them.

Thanks again,

Elliot Tardif

Elliot Tardif, Meteorologist I
NC DENR, Division of Air Quality
Planning Section, Attainment Planning Branch
1641 Mail Service Center
Raleigh, NC 27699-1641
Phone:  919-715-9773
Fax  :  919-715-7476
Email:  Elliot.Tardif@ncdenr.gov
Web  :  http://www.ncair.org

*****************************************************************************************
Email correspondence to and from this address is subject to the North Carolina Public Records Law and may be disclosed to third parties unless the content is exempt by statute or other regulation.
*****************************************************************************************

-----Original Message-----
From: ncl-talk-bounces@ucar.edu [mailto:ncl-talk-bounces@ucar.edu] On Behalf Of Adam Phillips
Sent: Wednesday, September 21, 2011 1:03 PM
To: ncl-talk@ucar.edu
Subject: Re: Wrfout wind profiler scripting

(ncl-talk: There has been an ongoing discussion offline on how to do this. The solution is shown here.)

Hi Elliot,
I was able to get a version of your code working. Trying to use gsn_csm_vector_scalar was a problem, as at each timestep you may have a different number of vertical levels. The solution was to use gsn_csm_xy to draw a blank plot, and then to use wmbarb to draw each wind barb individually. (Thanks to Dennis for this suggestion.) It isn't terribly efficient to draw each barb (or polymarker, polyline) separately, but in this case you really won't need to draw that many wind barbs.

The script is attached, along with the resulting plot. A few things you should be aware of:
1) The script assumes that each of your ascii files have the same number of columns, which is set at the top of the script.
2) The script uses the number of columns to deduce the number of levels.
Thus, you can read in multiple ascii files, each having a different set of levels.
3) The script assumes that for each column and row, that a number is present. (Thus, the slot isn't blank.) If this isn't the case the calculation of the number of levels may be thrown off.

Let me know if you have any questions about what I did or why. Hopefully the resulting plot is what you were after.
Adam

On 09/20/2011 07:25 AM, Tardif, Elliot M wrote:
> Hi Adam, I'm happy to report that I was able to get things figured out based on your advice. It took me a little while to translate into my script, but what I eventually did was read in the height variable "z", took the first hour's height field and read that in as my 'heights' array. I read in pressure initially, but found that height was more desirable because there was less variation over time. I then set a maximum height of about 5000m, and thinned out a few wind barbs at lower levels. I've attached my script and output.
>
> I do have a new question though....I am now attempting to produce
> similar output as in meteo4a.ps for observed hourly profiler data,
> which are in text files, one file per hour. The number of height
> levels are different in each file- some have a few, some have many.
> Right now, I'd like to produce output for one file, then work on
> producing output for more than one file. I have attached my script as
> it stands now (meteogramob.ncl), as well as the text file I'm reading
> in to NCL (1.txt). The current error message I get when attempting to
> run meteogramob.ncl is as follows: "fatal:Number of dimensions in
> parameter (1) of (gsn_csm_vector_scalar) is (1), (2) dimensions were
> expected
> fatal:Execute: Error occurred at or near line 93 in file meteogramob.ncl". Is it even possible to get the desired output in this case? If so, how?
>
> Thanks again for your help,
>
> Elliot Tardif.
>
>
> Elliot Tardif, Meteorologist I
> NC DENR, Division of Air Quality
> Planning Section, Attainment Planning Branch
> 1641 Mail Service Center
> Raleigh, NC 27699-1641
> Phone: 919-715-9773
> Fax : 919-715-7476
> Email: Elliot.Tardif@ncdenr.gov
> Web : http://www.ncair.org
>
> **********************************************************************
> ******************* Email correspondence to and from this address is
> subject to the North Carolina Public Records Law and may be disclosed to third parties unless the content is exempt by statute or other regulation.
> **********************************************************************
> *******************
>
> -----Original Message-----
> From: Adam Phillips [mailto:asphilli@ucar.edu]
> Sent: Thursday, September 15, 2011 12:38 PM
> To: Tardif, Elliot M
> Subject: Re: Wrfout wind profiler scripting
>
> Hi Elliot,
> It is definitely possible to overlay 2 plots created via gsn_csm_xy
> and gsn_vector_scalar, as long as the x and y axis ranges overlap for
> each plot. So that shouldn't be a problem.
>
> With regards to this warning: "warning:VectorFieldSetValues:
> coordinate array vfYArray requires 34 elements: defaulting."
>
> NCL is telling you that the number of elements of your top_bottom
> dimension of your plotting array (= size 34) does not match the number
> of pressures you input into vfYArray...Those dimension sizes much match.
> An alternative to setting vfYArray is to assign the pressure array as
> the 0th coordinate variable to your ugrid, vgrid, wspd array:
>
> ugrid&bottom_top = (your pressure array) and repeat for the other 2
> plotting arrays...
>
> Beyond this advice I'm not sure what else to say.. If the above
> doesn't help at all, email me the latest version of your script and
> assuming the data files are bigger than 10MB you can follow the ftp
> instructions here to get them to me:
> http://www.ncl.ucar.edu/report_bug.shtml
> Adam
>
>
> On 09/15/2011 08:18 AM, Tardif, Elliot M wrote:
>> Good morning Adam,
>>
>> Thanks for your response, but I might be a little misunderstood. I don't want to overlay pressure wind barbs on top of sigma wind barbs, I just want the pressure wind barbs. I wasn't sure if it was possible to overlay different plot types (e.g., gsn_csm_xy and gsn_vector_scalar) to be able to plot pressure wind barbs. Plotting it as you suggested, setting vfYArray = (pressure array) then producing the gsn_vector_scalar gives me this warning message: "warning:VectorFieldSetValues: coordinate array vfYArray requires 34 elements: defaulting." This means it's still producing the plot using sigma levels, and not pressure. I checked my home directory for a .hluresfile, and I do have one; the function code is ~.
>>
>> Thanks again for your help,
>>
>> Elliot Tardif.
>>
>> Elliot Tardif, Meteorologist I
>> NC DENR, Division of Air Quality
>> Planning Section, Attainment Planning Branch
>> 1641 Mail Service Center
>> Raleigh, NC 27699-1641
>> Phone: 919-715-9773
>> Fax : 919-715-7476
>> Email: Elliot.Tardif@ncdenr.gov
>> Web : http://www.ncair.org
>>
>> *********************************************************************
>> ******************** Email correspondence to and from this address is
>> subject to the North Carolina Public Records Law and may be disclosed to third parties unless the content is exempt by statute or other regulation.
>> *********************************************************************
>> ********************
>>
>>
>> -----Original Message-----
>> From: Adam Phillips [mailto:asphilli@ucar.edu]
>> Sent: Wednesday, September 14, 2011 5:42 PM
>> To: Tardif, Elliot M
>> Cc: ncl-talk@ucar.edu
>> Subject: Re: Wrfout wind profiler scripting
>>
>> Hi Elliot,
>> Sure, you can overlay, but as you said I'm not quite sure where you
>> would put the overlaid (pressure based) wind barbs. You could offset
>> the overlaid wind barbs by plotting the sigma wind barbs at say
>> (/0.8,1.8,2.8.3.8/), and then the pressure wind barbs at
>> (/1.2,2.2,3.2,4.2/)... Note that if you do that the sigma and
>> pressure values would have to be in the same range.
>>
>> To do all this you would create a 2nd plot, say, windlayer2, and set:
>> res2D@vfYArray = your_pressure_level_array
>> windlayer2 =
>> gsn_vector_scalar(wks,ugrid(bottom_top|:,Time|:),vgrid(bottom_top|:,T
>> ime|:),wspd(bottom_top|:,Time|:),uv_res)
>>
>> then
>> <snip>
>> overlay(loglin,windlayer) ; overlay plot with the loglin plot
>> overlay(loglin,windlayer2) ; overlay 2nd plot with the loglin plot
>> draw(loglin)
>> frame(wks) ; now frame the plot
>>
>> I've never specifically done this type of thing, but I see no reason
>> why it wouldn't work.
>>
>> Finally, looking at your plot (contains default fonts) it looks to me
>> like you don't have a .hluresfile set up in your home directory. We
>> recommend you set one up, if for no other reason that you change your
>> function code from : to ~:
>> http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml
>>
>> Hope that helps..
>> Adam
>>
>> On 09/14/2011 03:16 PM, Tardif, Elliot M wrote:
>>> Hi Adam, thanks very much for your response! After some further
>>> analysis, I think using pressure as my y-axis variable would be more suitable.
>> >The big challenge is how to fit the plotting of the pressure
>> variable into
>> > the script. I have the plot of the winds and wind speed
>> >
>> ("windlayer =
>> gsn_vector_scalar(wks,ugrid(bottom_top|:,Time|:),vgrid(bottom_top|:,T
>> ime|:),wspd(bottom_top|:,Time|:),uv_res)"),
>>
>> > but there's no room in this particular program to plot the wind barbs on
>> pressure levels across the time period, instead of on sigma levels.
>> I want to plot them like this to show the variation in pressure for a
>> given sigma level across the time period. Will an overlay of some
>> type work in this case?
>>>
>>> Thanks,
>>>
>>> Elliot Tardif.
>>>
>>> Elliot Tardif, Meteorologist I
>>> NC DENR, Division of Air Quality
>>> Planning Section, Attainment Planning Branch
>>> 1641 Mail Service Center
>>> Raleigh, NC 27699-1641
>>> Phone: 919-715-9773
>>> Fax : 919-715-7476
>>> Email: Elliot.Tardif@ncdenr.gov
>>> Web : http://www.ncair.org
>>>
>>> ********************************************************************
>>> ********************* Email correspondence to and from this address
>>> is subject to the North Carolina Public Records Law and may be disclosed to third parties unless the content is exempt by statute or other regulation.
>>> ********************************************************************
>>> *********************
>>>
>>> -----Original Message-----
>>> From: ncl-talk-bounces@ucar.edu [mailto:ncl-talk-bounces@ucar.edu]
>>> On Behalf Of Adam Phillips
>>> Sent: Tuesday, September 13, 2011 6:23 PM
>>> To: ncl-talk@ucar.edu
>>> Subject: Re: Wrfout wind profiler scripting
>>>
>>> Hi Elliot.
>>> Looking at your script I don't see an array that would house the
>>> height in meters of each sigma level. Sigma levels vary in height,
>>> so I'm not sure what you want to use as your heights. Regardless,
>>> assuming you have an array that houses the heights for each sigma
>>> level, I think the easiest thing for you to do would be to set
>>> uv_res@vfYArray = to your height array. Note that dimensions of your
>>> height array would have to match the bottom_top dimension of your ugrid/vgrid/wspd array.
>>>
>>> Hope that helps in some way. If not, let the group know..
>>> Adam
>>>
>>> On 09/13/2011 01:42 PM, Tardif, Elliot M wrote:
>>>> Good afternoon,
>>>>
>>>> I am attempting to produce wind profiler-type output from wrf
>>>> output files, colorizing the wind barbs by speed. I have
>>>> successfully done something like this using a combination of the wrf_meteo_5.ncl (link:
>>>> http://www.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/SP
>>>> ECIAL/wrf_meteo_5.ncl)
>>>> and the barb_4.ncl scripts (link:
>>>> http://www.ncl.ucar.edu/Applications/Scripts/barb_4.ncl), but the
>>>> y-axis is in sigma levels (see attached meteo4a.ps). Instead of
>>>> sigma levels, I would like to change the y-axis to height, in
>>>> meters, using the height of each sigma level for each hour. What do
>>>> I need to change in my NCL script (attached) to make this happen?
>>>>
>>>> Thanks,
>>>>
>>>> Elliot Tardif.
>>>>
>>>> Elliot Tardif, Meteorologist I
>>>>
>>>> NC DENR, Division of Air Quality
>>>>
>>>> Planning Section, Attainment Planning Branch
>>>>
>>>> 1641 Mail Service Center
>>>>
>>>> Raleigh, NC 27699-1641
>>>>
>>>> Phone: 919-715-9773
>>>>
>>>> Fax : 919-715-7476
>>>>
>>>> Email: Elliot.Tardif@ncdenr.gov<mailto:Nick.Witcraft@ncdenr.gov>
>>>>
>>>> Web : http://www.ncair.org<http://www.ncair.org/>
>>>>
>>>> *******************************************************************
>>>> **********************
>>>>
>>>> *Email correspondence to and from this address is subject to the
>>>> North Carolina Public Records Law and may be disclosed to third
>>>> parties unless the content is exempt by statute or other regulation*.
>>>>
>>>> *******************************************************************
>>>> **********************
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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

--
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 21 14:26:46 2011

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2011 - 17:12:44 MDT