[ncl-talk] Azimuthal average of vertical velocity

Dennis Shea shea at ucar.edu
Mon May 20 09:05:15 MDT 2019


Attached is a script and a library that

[1] imports vertical velocity across the five GRIB2 files,
[2] interpolates values to each time, level, radius
[3] averages to get radial means
[3] plots a spatial sample an an arbitrary pressure level and marks the
location of the central point
[4] plot the radial mean cross section

*LOOK* at the printVarSummary of each step

--
Also, the example data are on a rectilinear grid. However, the function
library should work for curvilinear grids [eg: WRF, NARR, ...]
using the *rcm2geocircle *function.

Good Luck
D

On Thu, May 16, 2019 at 3:06 AM David Warner <davidwarnerdavid1992 at gmail.com>
wrote:

> The filenames are ockhi03b.2017120100.hwrfprs.synoptic.0p125.f000.grb2,
> f006 and so on.
>
> On Thu, May 16, 2019 at 2:22 PM David Warner <
> davidwarnerdavid1992 at gmail.com> wrote:
>
>> Thank you very much for your response.
>>
>> I am trying to implement the same method for a variable chosen from the
>> model output which is in GRIB2 format.
>>
>> I have many forecast files(126hr forecast) initialized at 1-Dec-2017
>> 00:00 during the cyclone time. For time being I am attaching 5 forecast
>> files (f000, f006, f012, f018, f024) and I used "join" to concatenate all
>> the five files. (uploaded data files using ftp)
>>
>> Each grib2 file has got the following variables. And my task is to
>> compute the radius-height cross-section of the variable "TMP_P0_L100_GLL0"
>> for the desired forecast hour and lat/lon location.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *Variable: vNamesType: stringTotal Size: 568 bytes            71
>> valuesNumber of Dimensions: 1Dimensions and sizes:    [71]Coordinates:
>> (0)    TMP_P0_L1_GLL0(1)    TMP_P0_L7_GLL0(2)    TMP_P0_L100_GLL0(3)
>> TMP_P0_L103_GLL0(4)    POT_P0_L7_GLL0(5)    DPT_P0_L100_GLL0(6)
>> DPT_P0_L103_GLL0(7)    LHTFL_P0_L1_GLL0(8)    SHTFL_P0_L1_GLL0(9)
>> SPFH_P0_L100_GLL0(10)    SPFH_P0_L103_GLL0(11)    RH_P0_L100_GLL0(12)
>> RH_P0_L103_GLL0(13)    PWAT_P0_L200_GLL0(14)    CLWMR_P0_L100_GLL0(15)
>> RWMR_P0_L100_GLL0(16)    SNMR_P0_L100_GLL0(17)    RIME_P0_L100_GLL0(18)
>> TCOLR_P0_L200_GLL0(19)    TCOLS_P0_L200_GLL0(20)    UGRD_P0_L7_GLL0(21)
>> UGRD_P0_L100_GLL0(22)    UGRD_P0_L103_GLL0(23)    VGRD_P0_L7_GLL0(24)
>> VGRD_P0_L100_GLL0(25)    VGRD_P0_L103_GLL0(26)    VVEL_P0_L100_GLL0(27)
>> ABSV_P0_L100_GLL0(28)    UFLX_P0_L1_GLL0(29)    VFLX_P0_L1_GLL0(30)
>> VWSH_P0_L7_GLL0(31)    CD_P0_L103_GLL0(32)    PRES_P0_L1_GLL0(33)
>> PRES_P0_L7_GLL0(34)    PRMSL_P0_L101_GLL0(35)    HGT_P0_L1_GLL0(36)
>> HGT_P0_L7_GLL0(37)    HGT_P0_L100_GLL0(38)    HPBL_P0_L1_GLL0(39)
>> DSWRF_P0_L1_GLL0(40)    USWRF_P0_L1_GLL0(41)    DLWRF_P0_L1_GLL0(42)
>> ULWRF_P0_L1_GLL0(43)    CICE_P0_L100_GLL0(44)    TCOND_P0_L100_GLL0(45)
>> TCOLW_P0_L200_GLL0(46)    TCOLI_P0_L200_GLL0(47)
>> TCOLC_P0_L200_GLL0(48)    CAPE_P0_L1_GLL0(49)    CIN_P0_L1_GLL0(50)
>> HLCY_P0_2L103_GLL0(51)    REFD_P0_L100_GLL0(52)    REFC_P0_L200_GLL0(53)
>> NLAT_P0_L1_GLL0(54)    ELON_P0_L1_GLL0(55)    LAND_P0_L1_GLL0(56)
>> SFCR_P0_L1_GLL0(57)    WTMP_P0_L1_GLL0(58)    LCH_P0_L103_GLL0(59)
>> APCP_P8_L1_GLL0_acc(60)    NCPCP_P8_L1_GLL0_acc(61)
>> ACPCP_P8_L1_GLL0_acc(62)    DSWRF_P8_L1_GLL0_avg(63)
>> USWRF_P8_L1_GLL0_avg(64)    DLWRF_P8_L1_GLL0_avg(65)
>> ULWRF_P8_L1_GLL0_avg(66)    lv_HTGL2(67)    lv_ISBL1(68)    lv_ISBL0(69)
>> lat_0(70)    lon_0*
>>
>> But before proceeding to the averaging stuff, first I tried to understand
>> the input variable. I picked up "TMP_P0_L100_GLL0" (temperature) and this
>> is how it looks like after joining.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *Variable: tempType: floatTotal Size: 584384920 bytes
>> 146096230 valuesNumber of Dimensions: 4Dimensions and sizes:    [ncl_join |
>> 5] x [lv_ISBL0 | 46] x [lat_0 | 721] x [lon_0 | 881]Coordinates:
>>             lv_ISBL0: [200..100000]            lat_0: [57..-33]
>> lon_0: [14.2..124.2]Number Of Attributes: 12  center :    US National
>> Weather Service - NCEP (WMC)  production_status :    Operational products
>> long_name :    Temperature  units :    K  _FillValue :    1e+20  grid_type
>> :    Latitude/longitude  parameter_discipline_and_category :
>> Meteorological products, Temperature
>> parameter_template_discipline_category_number :    ( 0, 0, 0, 0 )
>> level_type :    Isobaric surface (Pa)  forecast_time :    0
>> forecast_time_units :    hours  initial_time :    12/01/2017 (00:00)*
>>
>> Since this is forecast, there is only*  forecast_time :    0*
>> information available from individual grib files. Now, how must I proceed
>> to assign the time information for the temp variable when I use "join"?
>> Which option would fit better to concatenate the forecast grib files
>> ("join" or "cat")?
>>
>> ncl 0>dnam = getvardimnames(temp)
>> ncl 1>print(dnam(0))
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *Variable: temp (subsection)Type: floatTotal Size: 20 bytes            5
>> valuesNumber of Dimensions: 1Dimensions and sizes:    [ncl_join |
>> 5]Coordinates: Number Of Attributes: 15  lon_0 :    14.2  lat_0 :    57
>> lv_ISBL0 :    200  initial_time :    12/01/2017 (00:00)
>> forecast_time_units :    hours  forecast_time :    0  level_type :
>> Isobaric surface (Pa)  parameter_template_discipline_category_number :    (
>> 0, 0, 0, 0 )  parameter_discipline_and_category :    Meteorological
>> products, Temperature  grid_type :    Latitude/longitude  _FillValue :
>> 1e+20  units :    K  long_name :    Temperature  production_status :
>> Operational products  center :    US National Weather Service - NCEP
>> (WMC)(0)    1e+20(1)    1e+20(2)    1e+20(3)    1e+20(4)    1e+20*
>>
>>  Shouldn't the output of the above command be 0,1,2,3,4 instead of 1e+20?
>> I am new to NCL and trying my best to figure out the things. Kindly help
>> me.
>>
>> Thanks in advance for your time and support.
>>
>> On Sat, May 11, 2019 at 4:11 AM Dennis Shea <shea at ucar.edu> wrote:
>>
>>> For sure, the [nice] plot was generated by NCL [panel plot with common
>>> labelbar].
>>> ---
>>> There was a 2017 thread on this topic. A rough approach [tst_polar.ncl]
>>> was attached to that thread.
>>> I cleaned it up and made it a function. A pic of the methodology used
>>> by  the function (or tries to do) is here:
>>>
>>> ; A conceptual sketch: A pic:
>>> ;
>>> *https://cs.stackexchange.com/questions/43744/fast-algorithm-for-interpolating-data-from-polar-coordinates-to-cartesian-coordi*
>>> <https://cs.stackexchange.com/questions/43744/fast-algorithm-for-interpolating-data-from-polar-coordinates-to-cartesian-coordi>
>>>
>>> This works in degrees not km.
>>>
>>> However, if your convert the 'radius' [degrees] to those that coincide
>>> with km distance, this should work!  I hope!!!
>>>
>>> The attached uses *random data *so the plot [azimuthal_avg.png] does
>>> not look too good.
>>> =====
>>>
>>> A better function would use "*geolocation_circle*
>>> <https://www.ncl.ucar.edu/Document/Functions/Contributed/geolocation_circle.shtml>
>>> "
>>> This optionally allows 'degrees' or 'km' as input and would allow for
>>> *much* higher spatial sample at each radii.
>>> Some example of its use are at:
>>>
>>> *https://www.ncl.ucar.edu/Applications/polyg.shtml*
>>> <https://www.ncl.ucar.edu/Applications/polyg.shtml>
>>> Examples*:*
>>>
>>> *polyg_24, polyg_25*
>>> *polyg_29, polyg_30 and polyg_31*
>>>
>>> Good luck
>>>
>>> On Fri, May 10, 2019 at 7:19 AM David Warner <
>>> davidwarnerdavid1992 at gmail.com> wrote:
>>>
>>>> [image: image.png]
>>>>
>>>> On Fri, May 10, 2019 at 6:46 PM David Warner <
>>>> davidwarnerdavid1992 at gmail.com> wrote:
>>>>
>>>>> Dear NCL community,
>>>>>
>>>>> Is there any function available in NCL to compute the azimuthal average of a 3D variable.
>>>>>
>>>>> For example, I need to plot something similar to the image displayed which is the height-radius crosssection of azimuthal average of vertical velocity.
>>>>>
>>>>> Given the lat and lon locations by the user, the function must compute the azimuthal mean of the variable.
>>>>>
>>>>> Any suggestions would be highly appreciated. Kindly reply at your earliest convenience.
>>>>>
>>>>>
>>>>> [image: image.png]
>>>>> (Image courtesy: Hui Wang et al., 2014)
>>>>>
>>>> _______________________________________________
>>>> 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/20190520/1621df9b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 333221 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190520/1621df9b/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rgrid2geocircle.ncl_talk
Type: application/octet-stream
Size: 6135 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190520/1621df9b/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grid2geocircle.ncl
Type: application/octet-stream
Size: 8465 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190520/1621df9b/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rgrid2geocircle_VVEL_P0_L100_GLL0.000001.png
Type: image/png
Size: 385136 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190520/1621df9b/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rgrid2geocircle_VVEL_P0_L100_GLL0.000002.png
Type: image/png
Size: 85692 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190520/1621df9b/attachment-0005.png>


More information about the ncl-talk mailing list