[gradsusr] Regarding uv2trw function

Mike Fiorino michael.fiorino at noaa.gov
Mon Oct 26 11:40:08 EDT 2020


hi Raghu,

sorry for the confusion about this extension...(I cc'd gradsusr)

attached is my version of the test script that does what you're looking 
for (mf-test.gs)

I've also attached the fortran code (ftn_uv2trw.F) and a couple of plots

a couple of notes...

1) the center in your script is way off from the wind speed minimum.  
the script shows how to get that center interactively by clicking on the 
wind speed plot.  this will make a very big difference in both the 
tangential and radial winds.  using the wind speed minimum, the diff is 
< 5 kts, but with your center > 80 kts!

2) the doc is correct...you used lon,lat but should be lat,lon  see below

3) I'm running this version on CentOs 7:

Config: v2.2.1.oga.1 little-endian readline grib2 netcdf hdf4-sds hdf5 
opendap-grids,stn athena geotiff shapefile
Grid Analysis and Display System (GrADS) Version 2.2.1.oga.1

you should update...

thanks for the enquiry...  had some GrADS fun this morning ;)

CC4N & best /R Mike


ga-> d uv2trw

Error from uv2trw: Too few args

           Usage:  uv2trw(u,v,latc,lonc,[iout]))

returns the tangential velocity (iout=1; the default) relative to a 
fixed lonc/latc
if no lonc/latc is provided, then the center of the grid is assumed the 
fixed point

Examples:

    ga-> d uv2trw(ua,va,latc,lonc,3)     (return the xy vcomp tangential 
wind
    ga-> d uv2trw(ua,va,latc,lonc,2)     (return the xy ucomp tangential 
wind
    ga-> d uv2trw(ua,va,latc,lonc,1)     (return the total tangential wind
    ga-> d uv2trw(ua,va,latc,lonc,-1)    (return the total radial wind
    ga-> d uv2trw(ua,va,latc,lonc,-2)    (return the xy ucomp radial wind
    ga-> d uv2trw(ua,va,latc,lonc,-3)    (return the xy vcomp radial wind




On 10/26/2020 01:29, Raghavendra Ashrit wrote:
> Dear Michael
>
> I am writing to you since I could not find any discussion or reply on
> gradsuser mail group.
>
> I am trying to use a function uv2trw developed and implemented by you in
> opengrads for a recent super cyclone 'Amphan' case over India. I am using
> opengrads, with all env correctly specified.
> ------------------
> Grid Analysis and Display System (GrADS) Version 2.0.2.oga.1
> Copyright (c) 1988-2011 by Brian Doty and the
> Institute for Global Environment and Society (IGES)
> -------------------------
> 'q udf' lists out all the stuff including the following
> uv2trw      Find radial/tangential velocity          f_uv2trw@^libmf.gex
>
> When I try to use it the function to obtain tangential wind for a level
> (pl see test.gs and the uvt.nc shared on google drive)
> https://drive.google.com/drive/folders/1AD1U-h-vWHBr-YAcOW-ko0DHax3hvYXP?usp=sharing
> I just get v wind at that level. Same with radial wind.  Let me know if I
> am missing something. If possible put me in touch with who can assist.
>
> Raghu
>
>
>
>

-------------- next part --------------
function main(args)

rc=gsfallow(on)
rc=const()

# -- open wind file
#
'sdfopen uvt.nc'

latb=19
late=23
lonb=85
lone=91

'set lat 'latb' 'late
'set lon 'lonb' 'lone
'set z 20'

# -- tracker center?
#
latc=20.28
lonc=87.66

getwmin=0

# -- wind min center
#
wlonc=87.84
wlatc=20.88

vskip=3

# -- plot the wind [kts]

'u=u*'_ms2kt
'v=v*'_ms2kt
'w=mag(u,v)'

'set gxout contour'
'set cint 10'
'd w'

'q w2xy 'lonc' 'latc
xtc=subwrd(result,3)
ytc=subwrd(result,6)

print 'CCCCC 'xtc' 'ytc
'draw wxsym 41 'xtc' 'ytc' 0.50 2'

# -- plot wind min interactive when getwmin=1
#
'q w2xy 'wlonc' 'wlatc
xtcw=subwrd(result,3)
ytcw=subwrd(result,6)
'draw wxsym 41 'xtcw' 'ytcw' 0.35 1'

# -- get wind min interactively when getwmin=1
#
if(getwmin)

  'q xy2w 'xw' 'yw

  wlonc=subwrd(result,3)
  wlatc=subwrd(result,6)

  print 'wind min lon: 'wlonc' lat: 'wlatc
  'q pos'
  'quit'

endif

# -- wind barbs

'set gxout barb'
'set digsiz 0.05'
'd u;skip(v,'vskip')'

# -- title and output
#
'draw title total wind [kts]'
'gxprint totwind.png x1024 y768'

'q pos'
'c'

# -- now get the rad/tan wind


# -- tangential wind speed
#
'vtw=uv2trw(u,v,'wlatc','wlonc',1)'
'vt=uv2trw(u,v,'latc','lonc',1)'

'set gxout contour'
'd vtw'

# -- u/v components of the tangential wind
#
'uvt=uv2trw(u,v,'wlatc','wlonc',2)'
'vvt=uv2trw(u,v,'wlatc','wlonc',3)'

'set gxout barb'
'd uvt;skip(vvt,3)'
'draw title tangential wind [kts]'
'gxprint tanwind.png x1024 y768'

'q pos'
'c'


# -- radial wind
#
'vrw=uv2trw(u,v,'wlatc','wlonc',-1)'
'set gxout contour'
'd vrw'

# -- u/v comp of radial wind
#
'uvr=uv2trw(u,v,'wlatc','wlonc',-2)'
'vvr=uv2trw(u,v,'wlatc','wlonc',-3)'

'set gxout vector'
'd uvr;skip(vvr,2)'

'draw title radial wind [kts]'
'gxprint radwind.png x1024 y768'

'q pos'
'quit'


'set gxout contour'
'set ccolor rainbow'
'd vt'

'set gxout vector'
'set arrscl 0.5 30'
'set ccolor 2'
'd uvt;vvt'


'q pos'
'quit'

'set ccolor 3'
'set arrscl 0.5 30'
'd uvr;vvr'

'set ccolor 1'
'set arrscl 0.5 30'
'd u;v'

return


function getloc(result)

return xmin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: totwind.png
Type: image/png
Size: 188078 bytes
Desc: not available
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20201026/674c3230/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tanwind.png
Type: image/png
Size: 195206 bytes
Desc: not available
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20201026/674c3230/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: radwind.png
Type: image/png
Size: 164642 bytes
Desc: not available
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20201026/674c3230/attachment-0005.png>


More information about the gradsusr mailing list