[gradsusr] How to combine the different nc files to calculate the mean and SD? Thanks.
Serge Claudio Rafanoharana
rafanoharana at gmail.com
Mon Jan 7 10:19:26 EST 2013
Hi,
Please refer to the CDO manual (attached). You can have a look at mergetime
(mentioned by Kishore), cdo info or cdo infon (will give you min, mean,
max, ...) and the std also is there.
Hope it can help.
Cheers,
Serge
On Mon, Jan 7, 2013 at 8:54 PM, Kishore Babu <kishoreragi at gmail.com> wrote:
> Hi,
>
> you can play very easily with nc file with simple handling cdo commands..
>
> As per your question, you want to add many files into a single file
> containing same variable for a longer time.
>
> I hope that you have installed cdo. If yes, just invoke the following
> command ...
>
> cdo mergetime input1.nc input2.nc input3.nc ........... output.nc
>
> That's it! you are done !!! your output file contains all the time you
> need..
>
> Cheers,
>
> Kishore
>
>
> On Mon, Jan 7, 2013 at 5:49 PM, 2008 duan <duan.scut.cn at gmail.com> wrote:
>
>> Dear Everyone,
>>
>> Happy New Year!
>>
>> Now I have a question to ask you. Thank you very much!
>>
>> 'reinit'
>>
>> 'sdfopen D:\TDDOWNLOAD\hgt.1981.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1982.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1983.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1984.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1985.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1986.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1987.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1988.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1989.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1990.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1991.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1992.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1993.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1994.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1995.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1996.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1997.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1998.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.1999.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2000.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2001.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2002.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2003.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2004.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2005.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2006.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2007.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2008.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2009.nc'
>> 'sdfopen D:\TDDOWNLOAD\hgt.2010.nc'
>> 'set mpdset hires'
>> yr=1981
>> while(yr<=2010)
>>
>> *******************************************************
>> *Standard deviation will be caculated
>> 'set lat 0 50.5'
>> 'set lon 119.5 179.5'
>>
>>
>> 'define mean=ave(hgt.'yr',time=01JAN'yr',time=31DEC'yr')'
>> 'define sd=sqrt(ave(pow(hgt.'yr'-mean,2),time=01JAN'yr',time=31DEC'yr'))'
>>
>> *********************************************************
>> *This is a skill to plot a shaded map with contour on it
>> 'set grads off'
>> 'set gxout shaded'
>> 'd sd'
>> 'cbarn'
>> 'set gxout contour'
>> 'set cthick 5'
>> 'd sd'
>> 'draw title Standard Deviation of 'yr' '
>> 'printim D:\TDDOWNLOAD\'yr'.png x1000 y800 white'
>> 'c'
>> yr=yr+1
>> endwhile
>> ;
>>
>> I donot know where are the wrongs. I want to figure out the mean and SD between 1981 to 2010.
>>
>> I want to ask how to combine the files containing hgt.1981.nc to hgt.2010.nc. If it is a single file, I think it is easy to figure out the mean and SD.
>>
>> Thank you everyone!
>>
>>
>> --
>> Weili Duan
>> Disaster Prevention Research Institute (DPRI), Kyoto University, Uji,
>> Kyoto 611-0011, Japan
>> TEL: +81-774-38-4131 FAX: +81-774-38-4130
>> E-mail: duan.scut.cn at gmail.com
>> duanwl1986 at flood.dpri.kyoto-u.ac.jp<dyuan.weiri.88r at st.kyoto-u.ac.jp><dyuan.weiri.88r at st.kyoto-u.ac.jp>
>>
>> _______________________________________________
>> 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
>
>
--
Serge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130107/8531948b/attachment-0003.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdo 1.5.0 manual.pdf
Type: application/pdf
Size: 1789215 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20130107/8531948b/attachment-0003.pdf
More information about the gradsusr
mailing list