palmmeteo.utils(3)

NAME
palmmeteo.utils

SYNOPSIS

  Classes
class DTIndexer
class NotWholeTimestep
class SliceBoolExtender
class SliceExtender
class Workflow

  Functions
parse_pos (pos, ngrid, resol)
distribute (what, into, reverse=False)
distribute_chunks (sizes, nthreads, prefix=(), reverse=False)
find_free_fname (fpath, overwrite=False)
tstep (td, step)
ensure_dimension (f, dimname, dimsize)
getvar (f, varname, *args, **kwargs)
assert_dir (filepath)

  Variables
ax_ = np.newaxis
int rad = np.pi / 180.
td0 = datetime.timedelta(0)
utc = datetime.timezone.utc
midnight = datetime.time(0)
dt utcdefault = lambda dt.replace(tzinfo=utc) if dt.tzinfo is None else dt
datetime midnight_of = lambda dt.datetime.combine(dt.date(), midnight, dt.tzinfo)
int eps_grid = 1e-3
fext_re = re.compile(r'\.(\d{3})$')
pos_re = re.compile(, re.X)
where_range = lambda mask: (np.argmax(mask), len(mask)-np.argmax(mask[::-1]))
min nearest_gridpt = lambda v, ngrid(ngrid-1, max(0, round(v)))

Detailed Description

A collection of simple, technical utilities.
These utilities need to be stateless, i.e. they must not depend on config or
runtime.

Function Documentation

  palmmeteo.utils.assert_dir ( filepath)

Creates a directory for an output file if it doesn't exist already.

  palmmeteo.utils.distribute ( what, into, reverse = False)

Distributes integer into integers as evenly as possible

  palmmeteo.utils.distribute_chunks ( sizes, nthreads, prefix = (), reverse = False)

Distributes an n-dim array among threads as evenly as possible

  palmmeteo.utils.ensure_dimension ( f, dimname, dimsize)

Creates a dimension in a netCDF file or verifies its size if it already
exists.

  palmmeteo.utils.find_free_fname ( fpath, overwrite = False)

  palmmeteo.utils.getvar ( f, varname, * args, ** kwargs)

Creates a variable in a netCDF file or returns it if it already exists.
Does NOT verify its parameters.

  palmmeteo.utils.parse_pos ( pos, ngrid, resol)

Parse position specified as one of the options (see pos_re). May raise ValueError.

  palmmeteo.utils.tstep ( td, step)

Fully divide datetime td by timedelta step.

Variable Documentation

  palmmeteo.utils.ax_ = np.newaxis

  int palmmeteo.utils.eps_grid = 1e-3

  palmmeteo.utils.fext_re = re.compile(r'\.(\d{3})$')

  palmmeteo.utils.midnight = datetime.time(0)

  datetime palmmeteo.utils.midnight_of = lambda dt.datetime.combine(dt.date(), midnight, dt.tzinfo)

  min palmmeteo.utils.nearest_gridpt = lambda v, ngrid(ngrid-1, max(0, round(v)))

  palmmeteo.utils.pos_re = re.compile(, re.X)

  int palmmeteo.utils.rad = np.pi / 180.

  palmmeteo.utils.td0 = datetime.timedelta(0)

  palmmeteo.utils.utc = datetime.timezone.utc

  dt palmmeteo.utils.utcdefault = lambda dt.replace(tzinfo=utc) if dt.tzinfo is None else dt

  palmmeteo.utils.where_range = lambda mask: (np.argmax(mask), len(mask)-np.argmax(mask[::-1]))

Author

Generated automatically by Doxygen for PALM-meteo from the source code.