tag:blogger.com,1999:blog-4834004831115556445.post4782226524601461465..comments2024-03-13T02:05:52.877-04:00Comments on GrADS-aholic!: Tutorial: How to save data into a .txt ascii file using GrADS; Example: Gridded Temperature DataUnknownnoreply@blogger.comBlogger28125tag:blogger.com,1999:blog-4834004831115556445.post-11119124166800910932023-12-05T04:12:15.320-05:002023-12-05T04:12:15.320-05:00I want to write time series data of a specific var...I want to write time series data of a specific variable for a single location and save it as a .txt file which I plan to transfer to a spreadsheet. But I've tried using the write() command and it does not work at all; GrADS simply returns with 'unknown command'. How do I solve this problem?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-21758063054120629902020-05-30T10:24:36.806-04:002020-05-30T10:24:36.806-04:00write only works when embedded in a script, not in...write only works when embedded in a script, not in interactive command windowAnonymoushttps://www.blogger.com/profile/15545992150890508087noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-28213755513225164032020-05-30T10:24:04.129-04:002020-05-30T10:24:04.129-04:00write only works when embedded in a scriptwrite only works when embedded in a scriptAnonymoushttps://www.blogger.com/profile/15545992150890508087noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-34268186922482342882018-03-10T01:10:58.404-05:002018-03-10T01:10:58.404-05:00what i wanted is to extract spatial average and is...what i wanted is to extract spatial average and is of different times and what i got is temporal average but of different spaces. what can i do in this situation.<br />Sanjibhttps://www.blogger.com/profile/11137284558887758271noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-56458803702614226362017-11-17T10:36:38.566-05:002017-11-17T10:36:38.566-05:00How about in reverse? I can read a txt file in GrA...How about in reverse? I can read a txt file in GrADS, but it's useless to me in any calculation. My script to read is as follows:<br /><br />txt = 'KYMN_Soil_Sites_FCHV.txt'<br />i = 1<br />while i < 10000<br /> input = read(txt)<br /> chk = sublin(input,1)<br /> if chk = 0<br /> nfo = sublin(input,2)<br /> date = subwrd(nfo,1)<br /> time = subwrd(nfo,2)<br /> st2 = subwrd(nfo,3)<br /> sm2 = subwrd(nfo,4)<br /> say date<br /> say time<br /> say st2<br /> say sm2<br /> else<br /> break<br /> endif<br /> i = i + 1<br />endwhile<br />input = close(txt)<br /><br />But, what can I do to make it usable for calculations from another script. Those variables I name as I read the data are gone as soon as it finishes. Anonymoushttps://www.blogger.com/profile/12785789102038002908noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-34743228167624479412017-08-26T16:26:11.937-04:002017-08-26T16:26:11.937-04:00Hi
Thank you for the tutorial. I'm very new t...Hi<br /><br />Thank you for the tutorial. I'm very new to GrADS. I'm following your tutorial to learn how to extract ascii data from netcdf file. Unfortunately, I failed to display the file. When I used http://monsoondata.org:9090/dods/rean2d.info, GrADS indicate 'couldn't ingest SDF meta data. I'm using the 2.0.a7 version. Could you help please. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-46486796738433884142017-08-02T20:36:26.351-04:002017-08-02T20:36:26.351-04:00Can someone specify how to run this code in versio...Can someone specify how to run this code in version 2.0.2? As others have pointed out, the `write` function is not available.Michaelhttps://www.blogger.com/profile/16615367646825440024noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-49582613507427750062017-05-11T12:08:29.497-04:002017-05-11T12:08:29.497-04:00I'm having the same problem.I'm having the same problem.Anonymoushttps://www.blogger.com/profile/12785789102038002908noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-55381882902817014742016-11-09T04:24:38.349-05:002016-11-09T04:24:38.349-05:00Hi Admin
I need a help.
I just need to print my l...Hi Admin<br /><br />I need a help.<br />I just need to print my lon, lat and var,<br />But, I could not get my var in the printed file.<br /><br />How, I know my var line?<br />I still confused with subline and subwrd<br /><br />Thank you very much<br /><br /><br />Anonymoushttps://www.blogger.com/profile/05768170139519250964noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-20240187636190719012016-11-04T18:14:00.442-04:002016-11-04T18:14:00.442-04:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/11400242270586656012noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-19430754946974509522016-11-04T18:12:06.485-04:002016-11-04T18:12:06.485-04:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/11400242270586656012noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-85293503659797148572016-07-15T05:34:41.820-04:002016-07-15T05:34:41.820-04:00Thanks Anonymous but in which line xmax and ymax v...Thanks Anonymous but in which line xmax and ymax values be replaced.bknhttps://www.blogger.com/profile/12549371794980546953noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-41909392180811199612016-07-12T09:57:07.694-04:002016-07-12T09:57:07.694-04:00I think one way you could do this is setting the e...I think one way you could do this is setting the extent you want in grads:<br /><br />'set lat 'lat1' 'lat2 ... etc<br /><br />Then doing a 'q dims', and I think one of the lines has the x/y dimensions for your subsetted domain. Then you can just replace the xmax and ymax values in the example provided here. That should get you started!<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-61910995386217313452016-07-12T07:03:04.695-04:002016-07-12T07:03:04.695-04:00Thanks for this script.But i wonde how can i defin...Thanks for this script.But i wonde how can i define a extent and extract the value for defines extent only. Because i have a dat for entire world when executing this script it is extracting the value for whoole world.bknhttps://www.blogger.com/profile/12549371794980546953noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-1827312137824309332015-02-10T05:33:42.657-05:002015-02-10T05:33:42.657-05:00same here. it always says unknown commandsame here. it always says unknown commandAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-3298730866034728922015-01-22T22:27:43.672-05:002015-01-22T22:27:43.672-05:00Hi I was wondering what version of Grads do I need...Hi I was wondering what version of Grads do I need to enable the write function. When I try running a script, a get an error message about the write functionAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-74939776040440592272014-10-15T03:51:15.847-04:002014-10-15T03:51:15.847-04:00I was able to output an image and values using the...I was able to output an image and values using the script though reading a different data set from NCEP sst daily mean values. I just want to ask if there was an error somewhere when in my terminal screen it says there "unknown command : 0. How about if i want to output using a specified domain. How can i get through it...Thanksviannoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-54983650030112746992014-10-15T03:49:28.309-04:002014-10-15T03:49:28.309-04:00I was able to output an image and values using the...I was able to output an image and values using the script though reading a different data set from NCEP sst daily mean values. I just want to ask if there was an error somewhere when in my terminal screen it says there "unknown command : 0. How about if i want to output using a specified domain. How can i get through it...ThanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-46610348639748264542014-10-05T18:00:17.907-04:002014-10-05T18:00:17.907-04:00Hi, sorry I didn't get back to you sooner. Th...Hi, sorry I didn't get back to you sooner. This is a common problem, and it is pretty simple to fix! Okay, so when you set your graphics to print ('set gxout print') and you display your variable, you get output to the screen. What I did to get the variable "tmp" to write to the .txt file, I needed to grab the part of that output that is the actual value. To do this, I use the "sublin" and "subwrd" commands. Example below.<br /><br />Printing Grid -- 1 Values -- Undef = -9.99e+08<br />278.05<br /><br />tmp=sublin(result,2)<br />tmp=subwrd(tmp,1)<br /><br />In this example, the temperature is on the 2nd line, so the 2nd argument in the sublin function is 2, if it were on the 3rd line, it would be 3, and so on. Since it is the 1st word on the 2nd line, my argument for the subwrd function is 1. <br /><br />It looks like you are grabbing wrong line in your sublin command: which is why you get "printing" as a value. See what line your data is on, and change the sublin command to match.<br /><br />Good luck, hope this helps!<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-88237564139693007912014-09-30T18:49:16.268-04:002014-09-30T18:49:16.268-04:00Hello,
I have a problem, in the file.txt in the ...Hello, <br /><br />I have a problem, in the file.txt in the part of the result say "printing"<br /><br />What does it means? <br /><br />Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-39532460003046891972014-08-09T14:09:04.484-04:002014-08-09T14:09:04.484-04:00Hi, I need some help. I make this:
'q pos'...Hi, I need some help. I make this:<br /><br />'q pos'<br /><br />say result<br />px=subwrd(result,3)<br />py=subwrd(result,4)<br /><br />say 'posicao x ='px<br />say 'posicao y ='py<br /><br />'q xy2w 'px' 'py''<br />say result<br /><br />plon=subwrd(result,3)<br />plat=subwrd(result,6)<br /><br /><br />**********************************************************<br />* Guardar puntos geograficos<br /><br />longitud='colonlat.csv'<br />fmt= '%8.3'<br />rc1=math_format(fmt,plon)<br />rc2=math_format(fmt,plat)<br />varf=rc1","rc2<br />rec= write(longitud,varf,closed)<br /><br />I get the file but I cannot get any value, so I dont now what to do... <br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-48982433408933727292014-04-11T13:04:39.884-04:002014-04-11T13:04:39.884-04:00Presuming, you are running GrADS from a php progra...Presuming, you are running GrADS from a php program (i'm not sure this is possible as I am not an expert in php), you can probably feed arguments to GrADS when you run the program: e.g., "run grads -bx script.gs lat lon" or whatever command runs a program from php. Then I recommend writing the CAPE variable out from GrADS into a .txt file. One GrADS has done its thing, you can then use php to open up the .txt file and read the cape variable as $cape. At that point you should be able to do with it as you wish using php.<br /><br />Hopefully, this is kind of what you were looking for?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-53822280194179999322014-04-10T19:26:45.853-04:002014-04-10T19:26:45.853-04:00Sorry, what we want to do is:
Specify a location i...Sorry, what we want to do is:<br />Specify a location in our script to get the value for that grid point in a variable in php. So for example, if we want the capesfc for the coordinates 56.0 -5.4 we retrieve one value of the amount of cape for that location. as lets say $cape<br /><br />We want to use the $cape in other calculations so the cape of the location specified above should be connected to $cape.<br /><br />Is that possible ? Thanks!Anonymoushttps://www.blogger.com/profile/09878010214764406220noreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-75593646218292014072014-04-10T19:21:36.238-04:002014-04-10T19:21:36.238-04:00I'm not exactly sure what you are trying to do...I'm not exactly sure what you are trying to do, are you trying to take your output from GrADS and run the ascii file into a php script? In that case it isn't too hard to load up. <br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4834004831115556445.post-82339162152785101462014-04-10T16:04:43.702-04:002014-04-10T16:04:43.702-04:00I got the output on commandline, works fine.. but ...I got the output on commandline, works fine.. but now tje final problem is how to get this in a variable in PHP so we can use the values in calculations... Did you know this ?Anonymoushttps://www.blogger.com/profile/09878010214764406220noreply@blogger.com