[gradsusr] how to make time series plot for multiple files with different time and grid resolution
Binyu Wang
bwang6 at gmu.edu
Wed Jul 1 12:44:16 EDT 2015
Dear Grads users,
I want to make time series plot for multiple files with different time resolutions.
The file with coarse resolution has monthly accumulation precipitation, while the one with fine resolution has daily precipitation. Both of them have 16 years of data. I can do the grid interpolation (see the first attachment), and also write a separate script to convert monthly data to daily precipitation because different months has different days (attachment 2), but how to combine them to make daily time series plots for the whole time period? Or maybe there is one command to convert monthly data to daily directly using Grads? Thank you very much.
Kelly
-----------------------------------------
'reinit'
* open coarse data
'open 3A11.ctl’
*open fine data 3A25
'open 3A25_fine.ctl'
'set grads off'
'set x 1 72'
'set y 1 16'
'set z 1 1'
'set t 1 204'
* to interplate grid resolution from fine to coarse
'define newvar=lterp(sfcr.2,mr.1)'
'set sdfwrite newvar.nc'
'sdfwrite newvar'
'set x 1'
'set y 1'
'd tloop(aave(newvar,lon=0,lon=360,lat=-90,lat=90))'
'd tloop(aave(mr.1,lon=0,lon=360,lat=-90,lat=90))'
——————————————————————
'reinit'
mday = '31 28 31 30 31 30 31 31 30 31 30 31'
month = '01 02 03 04 05 06 07 08 09 10 11 12'
'open 3A11.ctl'
'set t 1 204'
'define davg = md'
'set x 1 72'
'set y 1 16'
yr1 = 1998
yr2 = 2014
yr = yr1
while(yr<=yr2)
leap = 0
if(math_mod(yr,400) = 0 | math_mod(yr,4) = 0 & math_mod(yr,100) != 0)
leap = 1
* say yr' is a leap year.'
endif
imon = 1
while(imon <= 12)
md = subwrd(mday,imon)
mc = subwrd(month,imon)
if(imon = 2); md = md + leap; endif;
***** How to pass "md” to the monthly precipitation (mr) listed in the first script???"
imon = imon + 1
endwhile
yr = yr + 1
endwhile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150701/b5c3ff14/attachment.html
More information about the gradsusr
mailing list