[Thread Prev][Thread Next][Index]

Distribution of annual data across months



Hello Ferreters,
 
At Ansley's request I am sending this out to the list.  The problem started out simply as a request with a do loop and thanks to Ansley and Jaison I have made some progress but still need a little more help.
 
Here's the situation.
 
I am trying to manipulate two files, one has annual data for 100 years (ann_var).  The other has monthly data for 1 year (norm_var which is created from the NC file I read in).  I want to distribute the 100 annual values over 12 months such that the value for each month in a year is the same as the annual value (a total of twelve hundred values).  For the second file I want to distribute the monthly values over the 100 years such that the value for January in year one is the same as January in year 100.  
 
As you can see in the JNL below I was able to calculate the second step by using a climatological_axes.  But what am not able to figure out is how to do the first step, distributing the annual data over the 1200 points such that every month in a year contains the annual value.
 
Thanks for your help with this.  I'll post the solution to the listserve once we get it figured out.  ..By the way, we've explored using a nested do loop but I cannot get it to work correctly
 
Many thanks,
Barry
 
!--------Baker JNL ------------------------------------------------------
-- HadCM3 A2M
!- Define Magnitude of Warming for Model and Scenario (scenario.txt)
let tmpGW = 3.938
 
! Define lat and lon axis
!----------------------------
 define axis/x=-179.75:179.75:0.5/units=degrees lon
 define axis/y=-89.75:89.75:0.5/units=degrees lat
 
! Define 3 time axes
!----------------------------
 define axis/t="15-jan-2080:12:00":"15-dec-2080:12:00"/np=12 t12
 define axis/t="15-jun-2001:12:00":"15-jun-2100:12:00"/np=100 t100
 define axis/t="15-jan-2001:12:00":"15-dec-2100:12:00"/np=1200 t1200
 
set axis/modulo t12
set axis/modulo t100
set axis/modulo t1200
 
! Define 1D grid and read ascii file containing simulated (*.ann file)
!  annual global mean temperatures 2001 - 2100  (1,100)
!-----------------------------
 define axis/t="15-jun-2001 12:00":"15-jun-2100 12:00"/np=100/units=year tax
 define grid/t=t100 a2_ann
 file/grid=a2_ann/var=tann  "/mnt/hgfs/climdata/tyn_sc_2.01/anal_03_09_04/a2.txt"
 
! Define Grids
!----------------------------
 define grid/x=lon/y=lat/t=t12 gt12
 define grid/x=lon/y=lat/t=t100 gt100
 define grid/x=lon/y=lat/t=t1200 gt1200
 
! Convert 1D grid to 3D grid of Annual Global Warming
!----------------------------
 let zero = 0*x[gx=lon] + 0*y[gy=lat] + 0*t[gt=t100]
 let ann_var = zero + tann[d=1,gt=t100@asn]
 
! Read in netcdf file containing monthly 2080 anomaly (720,360,12)
!-----------------------------
 use  "/mnt/hgfs/climdata/tyn_sc_2.01/anal_03_09_04/hd.had3.a2m.2080s.pre.nc"
 
set axis/modulo time
 
use climatological_axes
cancel data climatological_axes
 
let test = pre[d=2,gt=month_reg@mod]
let test1 =  0*x[gx=lon] + 0*y[gy=lat] + 0*t[gt=t1200]
let norm_var = test1 + test[gt=t1200@asn]
 

 

Barry B. Baker, Ph.D.
Climate Change Modeler

bbaker@tnc.org
(303) 541-0322 (Phone)
(303) 449-4328 (Fax)
nature.org\tncscience\scientists\misc\baker.html
    The Nature Conservancy
Global Climate Change Initiative


2424 Spruce Street
Suite 100
Boulder, CO 80302
nature.org
     

"A reverence for uncertainty is one of the unrecognized implications of systems thinking" Peter Senge
 

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement