[gradsusr] lats4d for sum
Lee Byerle
lbyerle at yahoo.com
Mon Jan 21 16:33:10 EST 2013
Hi Estefania,
I'm glad the sum is working now. I have not tried your script, yet, but it seems if you add one line before the end statement it will loop through the other years.
Just before 'end' add:
@ ano = $ano + 1
good luck,
Lee
On Jan 21, 2013, at 9:33 AM, Estefanía Jiménez wrote:
> thank you Lee for all your help and patience!
>
> I got a new problem: I only get the script to do the first year... what am I missing??
>
> And I had to put
> sum(@*1000,time=00z$dia$mese[$mes]$ano,time=18z$dia$mese[$mes]$ano)
> instead of 'sum(@*1000,time=00z$dia$mese[$mes]$ano,time=18z$dia$mese[$mes]$ano)'
> 'cause if not I get another error
>
> I attach the newest version:
>
>
>
> #!/usr/bin/csh
>
> set mese = (jan feb mar apr may jun jul aug sep oct nov dec)
>
> @ ano = 1961
> while($ano <= 1990)
>
> @ mes = 1
> while($mes <= 12)
> if($mes < 10) then
> set mes = '0'$mes
> endif
>
> @ dia = 1
> while($dia <= 30)
> if($dia < 10) then
> set dia = '0'$dia
> endif
>
> echo 00z$dia$mese[$mes]$ano 18z$dia$mese[$mes]$ano
>
> /opt/grads30d/bin/gradsc -bpc "run /opt/grads30d/scripts/lats4d.gs -i /data/CR_presente_1960-1990/binctl/Eta_exp110km1960010100.ctl -o ../climat_6190sumaprec_diaria/sumaprec_$dia$mes$ano -ftype ctl -format grads_grib -vars prec -time 00z$dia$mese[$mes]$ano 18z$dia$mese[$mes]$ano -func sum(@*1000,time=00z$dia$mese[$mes]$ano,time=18z$dia$mese[$mes]$ano) -levs 1000 925 850 500 250 -table cptec.table"
>
> @ dia = $dia + 1
> end
>
> @ mes = $mes + 1
> end
>
> Regards and thanks again!
>
>
> 2013/1/18 Lee Byerle <lbyerle at yahoo.com>
> Estefania,
> Here is a sample lats4d command w/sum() that's working w/NOAA-CIRES 20th Cent reanalysis. I added back in -time (selects single time with t1 and t2 the same). I moved -func {expression} to sum 00-18Z prate after -vars expression, instead of before it.
>
> lats4d.sh -i http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/20thC_ReanV2/gaussian/monolevel/prate.1983.nc -vars prate -time 00z18jul1983 00z18jul1983 -func 'sum(@,time=00z18jul1983,time=18z18jul1983)' -format grads_grib -center ncep -o try.grb -v
>
> Lee
>
>
> On Jan 18, 2013, at 11:56 AM, Estefanía Jiménez wrote:
>
>> Tried all that... didn't work.
>>
>>
>>
>>
>> 2013/1/17 Lee Byerle <lbyerle at yahoo.com>
>> Hi Estefania,
>> Instead of t=, try time=
>>
>> You may consider testing with a specific set of times without the strings in the sum expression if the error persists.
>>
>> I hope this works.
>> Lee
>>
>>
>> On Jan 17, 2013, at 1:30 PM, Estefanía Jiménez <estefaniajimenez.r at gmail.com> wrote:
>>
>>> I got this error:
>>>
>>> GrADS-LATS Error: (lats_write) failed...
>>> Data Request Warning: Request beyond file limits
>>> LATS error (lats_write): LATS (lats.c) --> For GrADS convention, cannot skip timepoints; current time = 271716.000000 hours since 1960-1-1 0, previous time = 714.000000 hours since 1960-1-1 0, delta = 6, file = ../climat_6190sumaprec_diaria/sumaprec_12121961.grb, variable = prec
>>>
>>> any ideas? I attached the full script:
>>>
>>> #!/usr/bin/csh
>>>
>>> set mese = (jan feb mar apr may jun jul aug sep oct nov dec)
>>>
>>> @ ano = 1961
>>>
>>> while($ano <= 1990)
>>>
>>> @ mes = 1
>>> while($mes <= 12)
>>> if($mes < 10) then
>>> set mes = '0'$mes
>>> endif
>>>
>>> @ dia = 1
>>> while($dia <= 30)
>>> if($dia < 10) then
>>> set dia = '0'$dia
>>> endif
>>>
>>>
>>> /opt/grads30d/bin/gradsc -bpc "run /opt/grads30d/scripts/lats4d.gs -i /data/CR_presente_1960-1990/binctl/Eta_exp110km1960010100.ctl -o ../climat_6190sumaprec_diaria/sumaprec_$dia$mes$ano -ftype ctl -format grads_grib -func sum(@,t=00z$dia$mese[$mes]$ano,t=18z$dia$mese[$mes]$ano) -vars prec -levs 1000 925 850 500 250 -table cptec.table"
>>>
>>> @ dia = $dia + 1
>>> @ mes = $mes + 1
>>> end
>>> 25,5 Bot
>>>
>>>
>>>
>>> 2013/1/17 Estefanía Jiménez <estefaniajimenez.r at gmail.com>
>>> yuju! thanks a lot Lee!
>>>
>>>
>>> 2013/1/16 Lee Byerle <lbyerle at yahoo.com>
>>> Estefania,
>>> One suggestion is to remove the options -time and -mean and add -func 'sum(@,time=00z01...,time=18z30...)' to the Lats command (with your month, year and day strings included as before).
>>>
>>> Good luck,
>>> Lee
>>>
>>> On Jan 16, 2013, at 12:08 PM, Estefanía Jiménez <estefaniajimenez.r at gmail.com> wrote:
>>>
>>>> Hi all! Is there a way that I can transform this script to get the sum of the variables instead of the average??
>>>>
>>>>
>>>> /opt/grads30d/bin/gradsc -bpc "run /opt/grads30d/scripts/lats4d.gs -i /data/CR_presente_1960-1990/binctl/Eta_exp110km1960010100.ctl -o ../climat_6190/media_$mes$ano -ftype ctl -format grads_grib -mean -vars pslm pslc tp2m dp2m u10m v10m prec prcv neve clsf cssf ghfl tsfc qsfc tgsc tgrz ussl uzrs smav rnof evpp lwnv mdnv hinv cbnt ocis olis oces oles roce role albe agpl zgeo uvel vvel temp umrl omeg umes -time 00z01$mese[$mes]$ano 18z30$mese[$mes]$ano -levs 1000 925 850 500 250 -table cptec.table"
>>>>
>>>>
>>>>
>>>>
>>>> Thank you for your help!
>>>>
>>>> --
>>>> Estefanía Jiménez R.
>>>> Meteoróloga
>>>> Departamento de Climatología e Investigaciones Aplicadas
>>>> Instituto Meteorológico Nacional
>>>> MINAET
>>>> Tel: +506 2222 5616 ext 131
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>>
>>>
>>> --
>>> Estefanía Jiménez R.
>>> Meteoróloga
>>> Departamento de Climatología e Investigaciones Aplicadas
>>> Instituto Meteorológico Nacional
>>> MINAET
>>> Tel: +506 2222 5616 ext 131
>>>
>>>
>>>
>>> --
>>> Estefanía Jiménez R.
>>> Meteoróloga
>>> Departamento de Climatología e Investigaciones Aplicadas
>>> Instituto Meteorológico Nacional
>>> MINAET
>>> Tel: +506 2222 5616 ext 131
>>> _______________________________________________
>>> 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
>>
>>
>>
>>
>> --
>> Estefanía Jiménez R.
>> Meteoróloga
>> Departamento de Climatología e Investigaciones Aplicadas
>> Instituto Meteorológico Nacional
>> MINAET
>> Tel: +506 2222 5616 ext 131
>> _______________________________________________
>> 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
>
>
>
>
> --
> Estefanía Jiménez R.
> Meteoróloga
> Departamento de Climatología e Investigaciones Aplicadas
> Instituto Meteorológico Nacional
> MINAET
> Tel: +506 2222 5616 ext 131
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130121/be7067f0/attachment-0003.html
More information about the gradsusr
mailing list