PALM-meteo: palmmeteo.utils Namespace Reference

PALM-meteo

Classes | Functions | Variables
palmmeteo.utils Namespace Reference

## Classes
class | DTIndexer
class | NotWholeTimestep
class | SliceBoolExtender
class | SliceExtender
class | Workflow

## Functions
def | find_free_fname (fpath, overwrite=False)
def | tstep (td, step)
def | ensure_dimension (f, dimname, dimsize)
def | getvar (f, varname, *args, **kwargs)
def | assert_dir (filepath)

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

## Function Documentation

## ◆ assert_dir()

def palmmeteo.utils.assert_dir | ( |  | filepath | ) |

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

## ◆ ensure_dimension()

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

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

## ◆ find_free_fname()

def palmmeteo.utils.find_free_fname | ( |  | fpath,
|  |  | overwrite = `False`
| ) |  |

## ◆ getvar()

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

## ◆ tstep()

def palmmeteo.utils.tstep | ( |  | td,
|  |  | step
| ) |  |

    Fully divide datetime td by timedelta step.

## Variable Documentation

## ◆ ax_

palmmeteo.utils.ax_ = np.newaxis

## ◆ fext_re

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

## ◆ midnight

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

## ◆ midnight_of

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

## ◆ rad

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

## ◆ td0

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

## ◆ utc

palmmeteo.utils.utc = datetime.timezone.utc

## ◆ utcdefault

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

## ◆ where_range

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