[gradsusr] How to create a new Grads file?

Celso Bandeira de Melo Ribeiro celso.bandeira at ufjf.edu.br
Sat Nov 23 10:26:57 EST 2013


Hello Andrew and Mahakur, 
I finally found the problem. 
I was considering the number in UNDEF -999.
But when I open the NetCDF file in matlab I saw that the correct number is
UNDEF -999000000.
Then I used the follow descriptor file:

DSET ^pcp_%y4M%m2.nc
OPTIONS template
UNDEF -999000000
YDEF lat 136 LINEAR -21.1 0.2
XDEF lon 156 LINEAR -80.1 0.2
TDEF time 156 linear Jan2000 1mo
VARS 1
pcp=>PCP 0 99 precipitacao acumulada mensal
ENDVARS 

It works fine.
Thank you very much for your attention and suggestion.
Best wishes.
Celso



On Sat, 23 Nov 2013 00:07:25 -0800, Andrew Friedman
<andfried at berkeley.edu>
wrote:
> Hi Celso,
> 
> I’m not able to reproduce the problem using your script. What is
> pcp_2000M01_NEW.nc missing?
> Also, I try to use a different name for the defined variable so as to
> avoid confusion.
> 
> Andrew
> 
> On Nov 22, 2013, at 7:32 AM, Celso Bandeira de Melo Ribeiro
> <celso.bandeira at ufjf.edu.br> wrote:
> 
>> Hello Sujata Mandke, good morning,
>> Thank you for your attention.
>> I put de x and y dimensions, how you suggest (see below), but de
problem
>> continues.
>> 
>> 'xdfopen amazon_2000N.ctl'
>> 'set gxout shaded'
>> 'open mask_new.ctl'
>> 'set t 1'
>> 'set lat -21.1 6.1'
>> 'set lon -80.1 -48.9'
>> 'rec1 = maskout(pcp,mask.2(t=1))'
>> 'd rec1'
>> 'define pcp = rec1'
>> 'set sdfwrite pcp_2000M01_NEW.nc'
>> 'sdfwrite pcp'
>> 
>> Can anybody help me?
>> Thank you.
>> Celso
>> 
>> 
>> On Fri, 22 Nov 2013 12:40:06 +0530 (IST), Sujata Mandke
>> <amin at tropmet.res.in> wrote:
>>> Hello Celso,
>>>   I am not sure if this is the solution of your problem,
>>> but just try following - 
>>> in your 'SAVE_pcp.gs' after opening
>>> 'mask_new.ctl' you have 'set t 1', in addition
>>> set x and y dimensions also, before defining variable 'rec1'.
>>> regards
>>> Sujata Mandke
>>> 
>>> ----- Original Message -----
>>> From: Andrew Friedman <andfried at berkeley.edu>
>>> To: GrADS Users Forum <gradsusr at gradsusr.org>
>>> Sent: Fri, 22 Nov 2013 12:05:44 +0530 (IST)
>>> Subject: Re: [gradsusr] How to create a new Grads file?
>>> 
>>> Hi Celso,
>>> 
>>> I’m not sure if this is all of it, but SAVE_pcp.gs is missing a single
>>> quote at the end of the line 'define pcp = rec1’
>>> Can you try it now?
>>> 
>>> Andrew
>>> 
>>> On Nov 21, 2013, at 3:55 PM, Celso Bandeira de Melo Ribeiro
>>> <celso.bandeira at ufjf.edu.br> wrote:
>>> 
>>>> Hi Andrews and Grads users,
>>>> 
>>>> Can anybody help me?
>>>> I am trying to apply masking in NetCdf file (ORIGINAL file =
>>>> pcp_2000M01.nc) and trying to save de results in the same format
>> "NetCdf"
>>>> (result file = pcp_2000M01NEW.nc).
>>>> 
>>>> The script (SAVE_pcp.gs) is:
>>>> 'xdfopen amazon_2000N.ctl'
>>>> 'set gxout shaded'
>>>> 'open mask_new.ctl'
>>>> 'set t 1'
>>>> 'rec1 = maskout(pcp,mask.2(t=1))'
>>>> 'd rec1'
>>>> 'define pcp = rec1
>>>> 'set sdfwrite pcp_2000M01_NEW.nc'
>>>> 'sdfwrite pcp'
>>>> 
>>>> The results appear that it has been saved file but when I try to open
>> it
>>>> (using amazon_2000NEW.ctl) only show the limits (boundary), but not
the
>>>> data inside limits.
>>>> I am attaching the files that I am working.
>>>> I appreciate some help.
>>>> Celso
>>>> 
>>>> 
>>>> On Fri, 15 Nov 2013 10:10:28 -0800, Andrew Friedman
>>>> <andfried at berkeley.edu>
>>>> wrote:
>>>>> Hi Celso,
>>>>> 
>>>>> For save.gs, you also have to download the dependency scripts
>>>>> parsestr.gsf, parseopt.gsf, qdims.gsf and put them in your GrADS
>> script
>>>>> folder.
>>>>> The program should work for gridded data, and create a .ctl control
>> file
>>>>> and .dat data file. You can open them by using the command ‘open’ on
>>>>> the
>>>>> control file.
>>>>> 
>>>>> One issue I’ve had with save.gs recently is that the line OPTIONS
>>>>> _cal
>>>>> causes problems in the control file, so try commenting it out.
>>>>> 
>>>>> Alternatively, you could use the GrADS command sdfwrite to create a
>>>> netcdf
>>>>> file.
>>>>> 
>>>>> If your data aren’t gridded, you may want to try writing as ASCII
>>>>> following the instructions in the User’s Guide.
>>>>> 
>>>>> Andrew
>>>>> 
>>>>> 
>>>>> On Nov 14, 2013, at 1:24 PM, Celso Bandeira de Melo Ribeiro
>>>>> <celso.bandeira at ufjf.edu.br> wrote:
>>>>> 
>>>>>> Hello Andrew,
>>>>>> Thank you for your help.
>>>>>> I opened the script but I didn't understand how can I use it in may
>>>> case.
>>>>>> Could you help me more?
>>>>>> Thank you again.
>>>>>> Best wishes.
>>>>>> Celso
>>>>>> 
>>>>>> 
>>>>>> On Tue, 12 Nov 2013 17:01:07 -0800, Andrew Friedman
>>>>>> <andfried at berkeley.edu>
>>>>>> wrote:
>>>>>>> Hi Celso,
>>>>>>> 
>>>>>>> Check out save.gs by Bin Guan.
>>>>>>> 
>>>>>>> http://www.atmos.umd.edu/~bguan/grads/GrADS_Scripts.html#save.gs
>>>>>>> 
>>>>>>> Andrew
>>>>>>> 
>>>>>>> On Nov 12, 2013, at 4:01 PM, Celso Bandeira de Melo Ribeiro
>>>>>>> <celso.bandeira at ufjf.edu.br> wrote:
>>>>>>> 
>>>>>>>> Dear Grads user,
>>>>>>>> I need a help.
>>>>>>>> I'm trying to generate monthly rainfall files by accumulating
daily
>>>>>>>> rainfall from TRMM-MERGE.
>>>>>>>> I created an scripts in this Grads and it is adding precipitation
>>>> well
>>>>>>>> for
>>>>>>>> each month, but don't know how can I save this result, the
monthly
>>>> sum
>>>>>>>> in a
>>>>>>>> new Grads file.
>>>>>>>> Could someone help me to save the monthly rainfall data in a new
>>>> Grads
>>>>>>>> file?
>>>>>>>> Here the code I'm using in Grads.
>>>>>>>> 
>>>>>>>> 'open pcp.ctl'
>>>>>>>> 'jan = sum(prec,t=1,t=31)'
>>>>>>>> 'fev = sum(prec,t=32,t=59)'
>>>>>>>> 'mar = sum(prec,t=60,t=90)'
>>>>>>>> 'abr = sum(prec,t=91,t=120)'
>>>>>>>> 'mai = sum(prec,t=121,t=151)'
>>>>>>>> 'jun = sum(prec,t=152,t=181)'
>>>>>>>> 'jul = sum(prec,t=182,t=212)'
>>>>>>>> 'ago = sum(prec,t=213,t=243)'
>>>>>>>> 'sep = sum(prec,t=244,t=273)'
>>>>>>>> 'oct = sum(prec,t=274,t=304)'
>>>>>>>> 'nov = sum(prec,t=305,t=334)'
>>>>>>>> 'dec = sum(prec,t=335,t=365)'
>>>>>>>> 'd jan'
>>>>>>>> 
>>>>>>>> I would like to save each monthly file: jan, fev, mar,...,dec.
>>>>>>>> 
>>>>>>>> Best,
>>>>>>>> Celso
>>>>>>>> 
>>>>>>>> 
>>>>>>>> -- 
>>>>>>>> ____________________________________________
>>>>>>>> Prof. Celso Bandeira de Melo Ribeiro
>>>>>>>> Universidade Federal de Juiz de Fora - UFJF
>>>>>>>> Faculdade de Engenharia, Plataforma 4
>>>>>>>> Departamento de Engenharia Ambiental e Sanitaria
>>>>>>>> Bairro Martelos, Juiz de Fora (MG) CEP. 36036-900
>>>>>>>> tel. (32) 2102-3400
>>>>>>>> Visiting Scholar in Texas A&M University
>>>>>>>> _______________________________________________
>>>>>>>> gradsusr mailing list
>>>>>>>> gradsusr at gradsusr.org
>>>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>>> 
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> gradsusr mailing list
>>>>>>> gradsusr at gradsusr.org
>>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>> 
>>>>>> -- 
>>>>>> ____________________________________________
>>>>>> Prof. Celso Bandeira de Melo Ribeiro
>>>>>> Universidade Federal de Juiz de Fora - UFJF
>>>>>> Faculdade de Engenharia, Plataforma 4
>>>>>> Departamento de Engenharia Ambiental e Sanitaria
>>>>>> Bairro Martelos, Juiz de Fora (MG) CEP. 36036-900
>>>>>> tel. (32) 2102-3400
>>>>>> Visiting Scholar in Texas A&M University
>>>>>> _______________________________________________
>>>>>> gradsusr mailing list
>>>>>> gradsusr at gradsusr.org
>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> gradsusr mailing list
>>>>> gradsusr at gradsusr.org
>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>> 
>>>> -- 
>>>> ____________________________________________
>>>> Prof. Celso Bandeira de Melo Ribeiro
>>>> Universidade Federal de Juiz de Fora - UFJF
>>>> Faculdade de Engenharia, Plataforma 4
>>>> Departamento de Engenharia Ambiental e Sanitaria
>>>> Bairro Martelos, Juiz de Fora (MG) CEP. 36036-900
>>>> tel. (32) 2102-3400
>>>> Visiting Scholar in Texas A&M
>>>> 
>>
University<amazon_2000N.ctl><amazon_2000NEW.ctl><mask_new.ctl><mask_new.dat><pcp_2000M01.nc><pcp_2000M01_NEW.nc><SAVE_pcp.gs>_______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>> 
>>> 
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>> 
>>> 
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>> 
>> -- 
>> ____________________________________________
>> Prof. Celso Bandeira de Melo Ribeiro
>> Universidade Federal de Juiz de Fora - UFJF
>> Faculdade de Engenharia, Plataforma 4
>> Departamento de Engenharia Ambiental e Sanitaria
>> Bairro Martelos, Juiz de Fora (MG) CEP. 36036-900
>> tel. (32) 2102-3400
>> Visiting Scholar in Texas A&M University
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
> 
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

-- 
____________________________________________
Prof. Celso Bandeira de Melo Ribeiro
Universidade Federal de Juiz de Fora - UFJF
Faculdade de Engenharia, Plataforma 4
Departamento de Engenharia Ambiental e Sanitaria
Bairro Martelos, Juiz de Fora (MG) CEP. 36036-900
tel. (32) 2102-3400
Visiting Scholar in Texas A&M University


More information about the gradsusr mailing list