# [ncl-talk] Daily long term climatology

Amadou Coulibaly mpapin24 at gmail.com
Fri Aug 14 08:07:29 MDT 2015

```Hi Dennis Shea, Mr. Ndiaye and all,

That helped to compute daily mean, but I till have have two more issues.

1. From that daily mean, I tried to compute the annual mean
[T=new((/365,ncell/), float)], but the problem is that all years don't have
the same number of days, some have 365 days and other have 366 days. How to
solve this issue from daily data "xStat"?

2. I want to get indexes of the variations within 24 hours, but not for all
24h. I wrote like this:
time at units = "seconds since 1970-01-01 00:00:00"
dates = cd_calendar(time, 0)

index=ind(dates(:,3) .ge. 8 .and. dates(:,3) .le. 12 .and. dates(:,3) .ge.
18 .and. dates(:,3) .le. 23 .and. T(:) .ne. T at _FillValue)

if (.not.any(ismissing(index)) .and. dimsizes(index) .ge. 2) then

T0=T(index)
end if

Or

index1=ind(dates(:,3) .ge. 8 .and. dates(:,3) .le. 12 .and. T(:) .ne. T@
_FillValue)

index2=ind(dates(:,3) .ge. 18 .and. dates(:,3) .le. 23 .and. T(:) .ne. T@
_FillValue)

if (.not.any(ismissing(index1)) .and. .not.any(ismissing(index2)))
then

T0=T

end if

What is the best way to get the indexes of [8-12h] and [18-23] within 24h?

Best

On 12 August 2015 at 13:52, Dennis Shea <shea at ucar.edu> wrote:

> 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
> >
>

--
* 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*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150814/2283e9b5/attachment.html
```