[gradsusr] Editing Grid Cells

Stephen McMillan smcmillan at planalytics.com
Fri Apr 20 14:11:26 EDT 2018


Aaron,

You said you were not seeing expected results, but you didn't mention what
results you were getting at the suspect grid points.  Were they unchanged?
Were they changed, but different from expected?   If you include a 'say
'obs_val immediately before your 'set defval temp 'xx' 'yy' 'obs_val, what
is that value?  Is that the same as or different from what you would get
with 'q defval temp 'xx' 'yy *after* you 'set defval... ?

Also, you said you were reading from a CSV file, which implies there are
commas separating the values.  Did you take that into account when reading
the file?  Your sample code suggest you did not.

Stephen McMillan

On Fri, Apr 20, 2018 at 6:54 AM, Perry, Aaron <Aaron.Perry at lsc.vsc.edu>
wrote:

> 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
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>

-- 
***************************************************The information 
contained in this e-mail message is intended only for the use of the 
recipient(s) named above and may contain information that is privileged, 
confidential, and/or proprietary. If you are not the intended recipient, 
you may notreview, copy or distribute this message. If you havereceived 
this communication in error, please notify the sender immediately by 
e-mail, and delete the original 
message.***************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20180420/09b65a09/attachment.html>


More information about the gradsusr mailing list