[ncl-talk] calcMonAnomTLL

Dennis Shea shea at ucar.edu
Sat May 29 19:16:25 MDT 2021


Dave's analysis is correct.

This was amongst the earliest functions added to NCL [?late 199[7/8/9] ?]

It is the user's responsibility to examine the file(s). The example uses;

  air  = *short2flt*
<http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml>(
fa->air)                           ; air temp
  nobs = *short2flt*
<http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml>(
fb->air)                           ; # obs for air

because the data were of type *short *. They must be unpacked before usage.
---
The function requires the user to input a reference climatology as the 2nd
argument.

function calcMonAnomTLL (
		x     [*][*][*] : float or double,
		xAve [12][*][*] : numeric  )

Why?  Many papers/organizations used 1950-79 as a reference SST period.
Hence, we allowed the user to independently calculate the desired reference
climatology. [xAve]
This also allowed the reference period to be calculated from a different
SST.

Also, I think the data started in 1800. The 'moStrt' and 'moLast' were the
index values for the start and end of the period to be used.

Many other example use this function:

eof_3.ncl
*http://www.ncl.ucar.edu/Applications/eof.shtml*
<http://www.ncl.ucar.edu/Applications/eof.shtml>
eof_3_640.ncl
eof_4_640.ncl
godas_3.ncl
*http://www.ncl.ucar.edu/Applications/godas.shtml*
<http://www.ncl.ucar.edu/Applications/godas.shtml>
index_amo_1.ncl
*http://www.ncl.ucar.edu/Applications/indices.shtml*
<http://www.ncl.ucar.edu/Applications/indices.shtml>
indices_nino_1.ncl          *
http://www.ncl.ucar.edu/Applications/indices.shtml*
<http://www.ncl.ucar.edu/Applications/indices.shtml>
indices_oni_1.ncl
indices_oni_2.nc

Other examples:
bootstrap_correl_2.ncl
*http://www.ncl.ucar.edu/Applications/bootstrap.shtml*
<http://www.ncl.ucar.edu/Applications/bootstrap.shtml>
coads_3.ncl
*http://www.ncl.ucar.edu/Applications/coads.shtm*
<http://www.ncl.ucar.edu/Applications/coads.shtm>l
prn_osc_pat_1.ncl
*http://www.ncl.ucar.edu/Applications/prn_osc_pat.shtml*
<http://www.ncl.ucar.edu/Applications/prn_osc_pat.shtml>

On Fri, May 28, 2021 at 11:53 AM Dave Allured - NOAA Affiliate via ncl-talk
<ncl-talk at mailman.ucar.edu> wrote:

> 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,
>>
>> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210529/f8a5111e/attachment.html>


More information about the ncl-talk mailing list