Useful methods¶
The progress_bar
method gives you the ability to get some feedback while
processing data. It brings together the functionality of tqdm
and dask-distributed
.
esm_analysis.
progress_bar
(*futures, **kwargs)[source]¶Connect dask futures to tqdm progressbar.
The probress_bar method gives you the ability to get some feedback while processing data.
from dask.distributed import Client dask_client = Client() futures = dask_client.map(lambda x: x*2, [0, 2, 4, 6]) progress_bar(futures) Progress: 100%|████████████| 4.00/4.00 [00:00<00:00, 487it/s] results = dask_client.gather(results)
- Parameters
futures (collection) – collections of (dask, concurrent) futures
notebook (bool, optional (default: False)) – whether or not to display a progress bar optimized for jupyter notebooks
label (str, optional (default: Progress)) – Title of the progress bar
kwargs – Additional keyword arguments passed to the tqdm object
- Returns
collection
- Return type
futures
Variable Calculation¶
The Calculator
sub module offers some methods to calculated common variables
like relative humidity.
-
class
esm_analysis.
Calculator
¶ -
calc_rh
(temp, pres, temp_unit='K', pres_unit='hPa')¶ Calculate Realtive Humidity.
- Parameters
q (float, nd-array) – Specific humidity that is taken to calculate the relative humidity
temp (float, nd-array) – Temperature that is taken to calculate the relative humidity
pres (float, nd-array) – Pressure that is taken to calculate the relative humidity
temp_unit (str, optional (default: K)) – Temperature unit (C: Celsius, K: Kelvin)
pres_unit (str, optional (default: hPa)) – Pressure unit (hPa: ha Pascal, Pa: Pascal)
- Returns
Relative Humidity in percent
- Return type
float/nd-array
-
calc_sathum
(pres, temp_unit='K', pres_unit='hPa')¶ Calculate Saturation Humidity.
- Parameters
temp (float, nd-array) – Temperature that is taken to calculate the sat. humidity
pres (float, nd-array) – Pressure that is taken to calculate the sat. humidity
temp_unit (str, optional (default: K)) – Temperature unit (C: Celsius, K: Kelvin)
pres_unit (str, optional (default: hPa)) – Pressure unit (hPa: ha Pascal, Pa: Pascal)
- Returns
Saturation Humidity
- Return type
float/nd-array
-
calc_satpres
(unit='K')¶ Calculate saturation presure.
- Parameters
temp (float, nd-array) – Temperature that is taken to calculate the saturation pressure
unit (str, optional (default: K)) – Temperature unit (C: Celsius, K: Kelvin)
- Returns
Saturation Pressure in hPa
- Return type
float/nd-array
-