Re: Reorganise daily data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 04 2009 - 11:47:34 MST

If I understand correctly, you can not do what describe.

[1] do the addfiles ... get time and the desired variable
[2] from time

    utc_date = ut_calendar(time, 0)
    year = floattointeger(utc_date(:,0)) ; Convert to integer for
    month = floattointeger(utc_date(:,1)) ; use sprinti
    day = floattointeger(utc_date(:,2))
   ;hour = floattointeger(utc_date(:,3))
   ;minute = floattointeger(utc_date(:,4))
   ;second = utc_date(:,5)

    nmos = 12
    dimx = dimsizes( x )
    ntim = dimx(0)
    nlat = dimx(1)
    mlon = dimx(2)

; If "x" is (time,lat,lon)
; Calculate the 12 monthly means from the daily values
; Calculate anomalies from the monthly mean climatologies

    xAnomDay = x ; create an array to handle the daily values

    do nmo=1,nmos
       i = ind( month.eq.nmo )
       xMonClm = dim_avg_n( x(i,:,:) ) ; current month clim (lat,lon)

       xAnomDay(i,:,:) = (/ x(i,:,:) - xMonClm /)
       delete(i)
    end if

    xAnomDay = "Daily anomalies from each months climatology"

Gina Henderson wrote:
> Hi there,
>
> I am trying to reorder some data. I have daily model output broken up
> into files that have 30 days in each. I have this output for 40 years so
> approximately 480 files. I would like to do an addfiles across all
> files, read in a variable and then break it up into the structure (year,
> month, day, lat, lon), however as the day dimension will vary from month
> to month I am not sure how to deal with this.
>
> When I had monthly data I used the following:
> new_var = onedtond ( ndtooned (old_var), (/40, 12, 64, 128/))
>
> Has anyone dealt with this issue when dealing with daily data before? I
> need to compute daily anomalies from monthly means so will need to be
> able to sum across the month dimension but still have a day dimension
> per month.
>
> Any suggestions would be greatly appreciated.
> Thanks, Gina.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 4 11:47:21 2009

This archive was generated by hypermail 2.1.8 : Fri Nov 06 2009 - 09:15:29 MST