[gradsusr] Editing Grid Cells

Perry, Aaron Aaron.Perry at lsc.vsc.edu
Fri Apr 20 06:54:28 EDT 2018


Happy Friday All,


I'm trying to replace individual grid cells on a model grid( where ASOS stations are) with certain values from a CSV file.


Sample from CSV File:


K0J4 31.04250 -86.31167 84.9
K11R 30.21889 -96.37417 82.7
K12N 41.00928 -74.73628 51.0
K1A5 35.22277 -83.41497 82.5
K1A6 36.61056 -83.73722 80.0
K1M4 34.28028 -87.60028 75.9
K1P1 43.77714 -71.75598 46.5
K1V4 44.42010 -72.01930 46.0
K2WX 45.60444 -103.54639 57.9
K3I2 38.91444 -82.09833 69.0
K3LF 39.16052 -89.67419 63.8
K3T5 29.90806 -96.95 82.2
K40B 46.61667 -69.53333 39.3


Relevant GrADS Code:


'define temp = oacres(dummy.1(t=1),TMAX2m.2(t=1))'

''path1'color.gs -30 120 1'

'd temp'


istat = 0

while (istat != 2)

data = read("/home/weather/file.csv")
istat = sublin(data,1)

if (istat = 2)
break

endif

linez = sublin(data,2)

site = subwrd(linez,1)
obs_lat = subwrd(linez,2)
obs_lon = subwrd(linez,3)
obs_val = subwrd(linez,4)

'q w2gr 'obs_lon' 'obs_lat
xgrid = subwrd(result,3)
ygrid = subwrd(result,6)

xx = math_nint(xgrid)
yy = math_nint(ygrid)

*Get the value of the defined variable
'q defval temp 'xx' 'yy
val = subwrd(result,3)
say 'The value at grid point ('xx','yy') is --> 'val

'set defval temp 'xx' 'yy' 'obs_val

endwhile

rc = close("/home/weather/file.csv")

'd temp'


I have reviewed the man page for "set defval" (http://cola.gmu.edu/grads/gadoc/gradcomdsetdefval.html) and it appears that my coding is correct but, I am not seeing the results that I was expecting, i.e. a change in the grid values where the ASOS stations are.


Best,

Aaron D. Perry
Class of 2016
Lyndon State College
Lyndonville, VT 05851
Twitter: @arnpry<https://twitter.com/arnpry>
Email: Aaron.Perry at lyndonstate.edu<http://Aaron.Perry@lyndonstate.edu/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20180420/a60bf147/attachment.html>


More information about the gradsusr mailing list