[Thread Prev][Thread Next][Index]

Re: [ferret_users] Conversion of Weekly data to Monthly data



Hi Steeven,
What you did would work fine for creating say, weekly data from daily data, because a week is a standard 7 days long.

The general method for putting data onto an axis with a different resolution is to define an axis and use a regridding operation to put the data onto it.  This way the regridding is done correctly and you also have a new axis with the correct units, so that plots will be correctly labeled and if the data is saved to a file, the axis is documented.

So you need to define a monthly axis and use a regidding transformation to regrid your data onto that axis. The @AVE transformation uses weighted averages so that the correct part of each weekly grid cell contributes to each monthly average.

To define a true monthly axis, follow the directions found in the Users Guide Index under "axis, monthly, defining". This method correctly takes into account the different lengths of the months, and leap year days if needed.

So for instance, if your data is for the single year 2000:

! Define a 1-year monthly axis starting in Jan 2000
yes? LET start_year = 2000
yes? LET nyears = 1
yes? LET indices = L[L=1:`nyears*12 + 1`]
 !-> DEFINE VARIABLE indices = L[L=1:13]
yes? LET month = MOD(indices-1,12)+1
yes? LET year = start_year + INT((indices-1)/12)
yes? DEFINE AXIS/UNITS=days/T0=1-jan-1900/EDGES truemonth = DAYS1900(year,month,1)
 
yes? SHOW AXIS/t=1-jan-2000:31-dec-2000 truemonth
 name       axis              # pts   start                end
 TRUEMONTH TIME                12 i   16-JAN-2000 12:00    16-DEC-2000 12:00
T0 = 1-JAN-1900
   Axis span (to cell edges) = 366
 
       L     T                   TBOX      TBOXLO                TSTEP (DAYS)
       1>  16-JAN-2000 12:00:00  31         01-JAN-2000 00:00:00    36539.5
       2>  15-FEB-2000 12:00:00  29         01-FEB-2000 00:00:00    36569.5
       3>  16-MAR-2000 12:00:00  31         01-MAR-2000 00:00:00    36599.5
       4>  16-APR-2000 00:00:00  30         01-APR-2000 00:00:00    36630
       5>  16-MAY-2000 12:00:00  31         01-MAY-2000 00:00:00    36660.5
       6>  16-JUN-2000 00:00:00  30         01-JUN-2000 00:00:00    36691
       7>  16-JUL-2000 12:00:00  31         01-JUL-2000 00:00:00    36721.5
       8>  16-AUG-2000 12:00:00  31         01-AUG-2000 00:00:00    36752.5
       9>  16-SEP-2000 00:00:00  30         01-SEP-2000 00:00:00    36783
      10>  16-OCT-2000 12:00:00  31         01-OCT-2000 00:00:00    36813.5
      11>  16-NOV-2000 00:00:00  30         01-NOV-2000 00:00:00    36844
      12>  16-DEC-2000 12:00:00  31         01-DEC-2000 00:00:00    36874.5

! Regrid your weekly data to this axis. If your variable is called var,

yes? let var2 = var[gt=
truemonth@AVE]


steeven paul yerraguntla wrote:
Dear ferreters,

           I have weekly data netcdf files and i want them convert to monthly data. I have used the operand @ave to convert weekly data to monthly, such that l=1:52:4@ave. But  some months are having 5 weeks and some are having 4 weeks data then how to average the 5 weeks of particular month?.  Kindly let me know if there is  any generalised way to  convert  weekly data to monthly data. The following lines shows the example of non uniformity in number of weeks for different months.


01-NOV-2000 00 / 44: 33.47
08-NOV-2000 00 / 45: 33.45
15-NOV-2000 00 / 46: 33.45
22-NOV-2000 00 / 47: 33.47
29-NOV-2000 00 / 48: 33.48

06-DEC-2000 00 / 49: 33.04
13-DEC-2000 00 / 50: 33.04
20-DEC-2000 00 / 51: 33.04
27-DEC-2000 00 / 52: 33.04


Solution for the above problem will be highly appreciated.

regards,
--
Steeven Paul Y
Research Fellow
NIO RC Vizag
176 Lawsons Bay Colony
Visakhapatnam - 530017
7

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement