[gradsusr] (no subject)

Jeff Duda jeffduda319 at gmail.com
Wed Nov 23 12:58:39 EST 2011


Alireza,
Well, as I said, use that fprintf program I linked to you in my previous
email.  You can copy it to your own file system and make it a script.  The
script has help text to tell you how to use it.  As far as opening the
files using a while loop, use the following code within a Grads script:

i = 1
while (i <= 200)
'open (filename that has something to do with the index i.  This can be
either a string array with index value i or some literal value that
involves i that is part of the filename)'
(use fprintf to write data to file)
i = i + 1
endwhile

Jeff

On Wed, Nov 23, 2011 at 11:40 AM, Alireza Azargoun <
alireza.azargoun at gmail.com> wrote:

> Tnx jeff.
>
> I explained the problem in a wrong way. I don't have any problem with
> opening the files. i used g2ctl and gribmap( I already created CTLs and
> IDXs for all files)  and  I can easily read data from a file or maybe 10
> files. but there are 200 files. and I need a :
> 1- while loop to open the files. ( can anybody tell me why "while" is not
> working)
> 2- I need to learn how to write results and variables in a text file!
>
>
>
>
> On Wed, Nov 23, 2011 at 9:00 PM, Joey Woodson <
> instantweathermaps at gmail.com> wrote:
>
>> g2ctl works just as well with the grib2 files.
>>
>>
>> On Wed, Nov 23, 2011 at 11:24 AM, Jeff Duda <jeffduda319 at gmail.com>wrote:
>>
>>> My experience with grib2 files is to use convgrb to convert them to
>>> grib1 files, then use grib2ctl.pl to get a control file for each
>>> converted grib1 file.  You can do that using a C-shell loop.  Once you do
>>> that, you can use a while loop in a Grads script (not at the command
>>> prompt), to open each individual file and print the data to a text file
>>> using fprintf<http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file>.
>>>
>>> Jeff Duda
>>>
>>> On Wed, Nov 23, 2011 at 10:55 AM, Alireza Azargoun <
>>> alireza.azargoun at gmail.com> wrote:
>>>
>>>> Dear GrADS users
>>>> Hi everybody
>>>>
>>>> I have about 200 grib2 files ( 1.grb2 ~ 200.grb ) . i need to read a
>>>> temperature of a city (lat, lon, lev, time are constant in all files) . how
>>>> i can read this files using a while loop!?  ( I receive this error when i
>>>> write a while. Unknown Command: while )
>>>>  and how can i write these data to a text file!? I've searched all
>>>> grads option for a command that writes variables in a text file! but i
>>>> couldn't find it!
>>>>
>>>> Thanks in advance,
>>>> Alireza
>>>> Sharif University of Technology
>>>>
>>>>
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>
>>>>
>>>
>>>
>>> --
>>> Jeff Duda
>>> Grad student - PhD, Meteorology
>>> University of Oklahoma School of Meteorology - Center for Analysis and
>>> Prediction of Storms
>>>
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>>
>>
>> --
>>
>> http://www.instantweathermaps.com
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> Alireza Azargoun
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Grad student - PhD, Meteorology
University of Oklahoma School of Meteorology - Center for Analysis and
Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20111123/a654d3b1/attachment-0003.html 


More information about the gradsusr mailing list