[ncl-talk] calcMonAnomTLL

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Fri May 28 11:53:16 MDT 2021


There is a bit of missing information in the example.  I think the
expectation is that you are supposed to get copies of the input files,
examine their metadata, and figure out some of these things as an
educational exercise.  But I agree that it is a bit mysterious.  This is
what I deduce from reading the example and documentation, and being
familiar with common structures in climate data.

* Dimensions of the two main input file variables are (time, lat, lon).
* The input files are a series of monthly grids in chronological order, 12
monthly grids for each year in the file.
* The input months are stacked on a single time dimension, so that December
of one year is immediately followed by January of the next year.
* The first month in the input files is January 1800.

The example computes monthly anomalies for a 30-year time range, and NOT
starting at the beginning of the files.  Therefore, integer subscripts for
the first and last time steps in the requested time range are needed.
Subtract 1800 to get the year offset from the start of the file, to the
start of the requested anomaly period.  Then multiply by 12 to convert from
integer year offsets, to integer month offsets.

As briefly noted in the comments, moStrt and moLast are the first and last
integer subscripts to access all 12 months of the requested time range,
1950 through 1979.  In particular, that is January of the first year,
through December of the last year.


On Fri, May 28, 2021 at 11:16 AM setare rahimi via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Dear all NCL users,
>
> I visited this link:
> https://www.ncl.ucar.edu/Document/Functions/Contributed/calcMonAnomTLL.shtml
>  , which is about monthly anomalies. But I could not understand the way
> it calculates the anomalies.
>
> _____________________________________________________________________________________________
>
> Example 1
>
>   fa     = *addfile* <https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>("air.mean.nc","r")
>   fb     = *addfile* <https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>("air.nobs.nc","r")
>
>   air  = *short2flt* <https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml>( fa->air)                           ; air temp
>   nobs = *short2flt* <https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml>( fb->air)                           ; # obs for air
> ; filter out geographic locations that have < nMin observations
>   nMin   = 2                                           ; min # obs
>   air    = *mask* <https://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml>(air,nobs.ge.nMin,True)
>
> ;---Compute the climatology using a function in contributed.ncl
>   yrStrt = 1950
>   yrLast = 1979
>   moStrt = (yrStrt-1800)*12              ; start subscript
>   moLast = (yrLast-1800)*12 + 11         ; last  subscript
>   clm = *clmMonTLL* <https://www.ncl.ucar.edu/Document/Functions/Contributed/clmMonTLL.shtml> (air(moStrt:moLast,:,:)) ; monthly climatology
>
> ;---Compute the anomalies from the climatology just computed
>   xAnom = *calcMonAnomTLL* (air,clm)
>
> _________________________________________________________________
>
> May I ask you please explain subscript method? Why using 1800 and then multiply 12?
>
> what do moStrt and moLast show?
>
> I appriciate any advse
>
> All the best,
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210528/16a27809/attachment.html>


More information about the ncl-talk mailing list