[ncl-talk] Daily long term climatology

Dennis Shea shea at ucar.edu
Wed Aug 12 07:52:02 MDT 2015


You do not need to get data into  a (time, lev, lat, lon)  array.
Also, your data are not in a 'rectangular' structure. The 'cells' are
station data. The array is 'unstructured'

===
UNTESTED ... That is *your* responsibility. Please think about each step.
===
    x       = f->air_temperature
    printVarSummary(x)

    dimx = dimsizes(x)
    ntim  = dimx(0)
    ncell = dimx(1)

   nstep = 24                     ; # of time steps/day
   ndim  = 0                       ; 'time' is the 0-th dimension

    NTIM  = ntim/nstep      ; # of days
    xStat  = new ( (/NTIM,ncell/), typeof(x), getFillValue(x))

    do n=0,ntim-1,nstep
         xStat(n/nstep,:) = dim_avg_n( x(n:n+nstep-1,:), ndim)
     end do

     xStat!0 = "time"
     xStat&time = time(::nstep)
     xStat!1 = "ncells"
     xStat at long_name = "daily mean temperature"
     xStat at units           = x at units

     printVarSummary(xStat)

On Wed, Aug 12, 2015 at 6:23 AM, ousmane ndiaye <ondiaye70 at gmail.com> wrote:
> use reshape function
> https://www.ncl.ucar.edu/Document/Functions/Built-in/reshape.shtml
> ousmane
>
> On Wed, Aug 12, 2015 at 11:51 AM, Amadou Coulibaly <mpapin24 at gmail.com>
> wrote:
>>
>> Hi NCL users,
>>
>> I have hourly data for 10 years. I want to compute long term daily mean
>> (daily climatology) of the variable "temp=air_temperature". But my variable
>> "temp" is in form:
>>
>>   Variable: temp
>> Type: float
>> Total Size: 48390528 bytes
>>             12097632 values
>> Number of Dimensions: 2
>> Dimensions and sizes:    [time | 262992] x [ncells | 46]
>> Coordinates:
>>             time: [410227200..1356994800]
>> Number Of Attributes: 7
>>   _FillValue :    9.96921e+36
>>   units :    K
>>   code :      11
>>   shortname :    ta
>>   comment :    Air temperature is the bulk temperature of the air, not the
>> surface (skin) temperature.
>>   grid_type :    unstructured
>>   coordinates :    lon lat
>>
>> How to change "temp" into temp(time,lev,lat,lon)? So that I can get daily
>> mean.
>>
>> Or is there any other ways to do it?
>>
>> Variable is from:
>>
>>  Variable: infile
>> Type: file
>> filename:    fil
>> path:    /home/amadou/NCL/fil.nc
>>    file global attributes:
>>    dimensions:
>>       ncells = 46
>>       nchar = 20
>>       time = 262992
>>    variables:
>>       double time ( time )
>>          units :    seconds since 1970-01-01 00:00:00
>>          standard_name :    time
>>
>>       float lat ( ncells )
>>          units :    degrees_north
>>          standard_name :    latitude
>>          long_name :    latitude
>>
>>       float lon ( ncells )
>>          units :    degrees_east
>>          standard_name :    longitude
>>          long_name :    longitude
>>
>>       character station_id ( ncells, nchar )
>>          comment :    WMO or GHCN number of the station
>>
>>       float air_temperature ( time, ncells )
>>          _FillValue :    9.96921e+36
>>          units :    K
>>          code :      11
>>          shortname :    ta
>>          comment :    Air temperature is the bulk temperature of the air,
>> not the surface (skin) temperature.
>>          grid_type :    unstructured
>>          coordinates :    lon lat
>>
>> Is there anyone who can help me?
>> Best regards
>>
>> --
>>  COULIBALY   AMADOU
>> PhD  Student  on  West  African  Climate  System (WACS)
>> FUTA - Federal  University  of  Technology of Akure, Nigeria
>>
>> Visiting Student - University of Cologne, Germany
>> Institute of Geophysics and Meteorology
>> Pohligstr. 3 / Office 3.102
>> D-50969 Köln
>>
>> Project: WASCAL (West African Science Service Centre on Climate Change and
>> Adapted Land Use)
>> Phone:(+234) 810 795 2836 /(+223) 65 67 27 57 /(+226) 64 57 37 27 /+49
>> 15218352574
>>
>> E-mail: mpapin24 at gmail.com / coulibalya68 at yahoo.com
>>
>> "The time is always right to do right": Nelson Mandela
>>
>> "Character is like a tree and reputation like a shadow.  The shadow is
>> what we think of it; the tree is the real thing" : Abraham Lincoln
>>
>> "Do what you can, with what you have, where you are" Theodore Roosevelt
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


More information about the ncl-talk mailing list