geodat.nc.TimeSlices

geodat.nc.TimeSlices(var, lower, upper, toggle, no_continuous_duplicate_month=False)[source]

Return a time segment of the variable according to the lower (inclusive) and upper limits (inclusive)

Parameters:
  • var (geodat.nc.Variable) –
  • lower (numeric) – lower time limit
  • upper (numeric) – upper time limit
  • toggle (str) – Y/m/d/H/M/S to select a particular time format
  • no_continuous_duplicate_month (bool) – default False; make sure the difference between calendar months in the time axis is always larger than or equal to 1; only suitable for dealing with monthly data.
Returns:

geodat.nc.Variable

Examples

>>> # time segments in Nov, Dec, Jan and Feb
>>> TimeSlices(var,11.,2.,"m")
>>> # time segments from year 1990 to 2000 (inclusive)
>>> TimeSlices(var,1990,2000,"Y")
>>> '''Say 01-01-0001 and 31-01-0001 are two adjacent time
>>> steps as far as monthly data is concerned, the second
>>> time step 31-01-0001 should be considered as the
>>> beginning of February and not as January.  So we
>>> want no_continuous_duplicate_month=True '''
>>> TimeSlices(var,1,2,"m",True)
Fork me on GitHub