temperature
Functions to make adjustments to temperature maps.
- template(ds, var, out_var=None)
Example enhancer function.
- Parameters
ds (xr.Dataset) – Input dataset.
var (str) – Variable to adjust.
out_var (str, optional) – variable to store new variable, by default None.
- Returns
Output dataset.
- Return type
xr.Dataset
- kelvin_to_celsius(ds, var, in_var=None, out_var=None)
Convert units of a variable from Kelvin to degrees Celsius.
- Parameters
ds (xr.Dataset) – Dataset containing var.
var (str) – Variable name.
in_var (str, optional) – Overwrites var, by default None.
out_var (str, optional) – Instead of overwriting var, store the new data in out_var, by default None.
- Returns
Adjusted data.
- Return type
xarray.Dataset
- celsius_to_kelvin(ds, var, out_var=None)
Convert units of a variable from Kelvin to degrees Celsius.
- Parameters
ds (xr.Dataset) – Dataset containing var.
var (str) – Variable name.
out_var (str, optional) – Instead of overwriting var, store the new data in out_var, by default None.
- Returns
Adjusted data.
- Return type
xarray.Dataset
- lapse_rate(ds, var, out_var=None, lapse_var='z', radius=0.25, lapse_rate=-0.006)
Apply a lapse-rate to var inside ds based on the difference between the actual value of lapse_var and its local (defined by radius) mean.
- Parameters
ds (xarray.Dataset) – Dataset with the data.
var (str) – Name of the variable inside ds to apply this function to (y).
out_var (str, optional) – Instead of overwriting var, store the new data in out_var, by default None.
lapse_var (str, optional) – The variable used to calculate dx.
radius (float, optional) – The local altitude is compared to the local mean altitude, radius (in degrees) defines over which area to calculate the mean, by default 0.25.
lapse_rate (float, optional) – dy/dx, i.e. how much should var be adjusted per difference in lapse_var, by default -0.006.
- Returns
Adjusted data.
- Return type
xarray.Dataset
- create_circle(pixel_size_x, pixel_size_y, radius, boolean=False)
Create a 2d array with pixel values representing the distance to the center of the array.
- Parameters
pixel_size_x (float) – Size of a pixel in the x-direction. Unit can be anything, as long as it is the same as for pixel_size_y and radius.
pixel_size_y (float) – Size of a pixel in the y-direction. Unit can be anything, as long as it is the same as for pixel_size_x and radius.
radius (float) – Size of the circle. Unit can be anything, as long as it is the same as for pixel_size_x and pixel_size_y.
boolean (bool, optional) – Return distances to center (False) or whether or not the distance to the center is smaller than radius (True), by default False.
- Returns
Values representing the distance to the center of the array.
- Return type
ndarray
- local_mean(array, pixel_size, radius, method=3)
Calculate local means.
- Parameters
array (ndarray) – Two dimensional array for which local means will be calculated.
pixel_size (tuple) – Size of the pixels in array in x and y direction respectively.
radius (float) – Size of the circle around each pixel from which to calculate the local mean.
- Returns
Array with the local mean of each pixel.
- Return type
ndarray
- bt_to_lst(ds, x, ndvi_s=0.2, ndvi_v=0.5, emis_s=0.97, emis_v=0.985)
Convert brightness temperature to land surface temperature according to Sobrino et al (2008).
- Parameters
ds (xr.Dataset) – Input.
x (None) – Not used.
ndvi_s (float, optional) – Threshold value, by default 0.2
ndvi_v (float, optional) – Threshold value, by default 0.5
emis_s (float, optional) – Threshold value, by default 0.97
emis_v (float, optional) – Threshold value, by default 0.985
- Returns
Dataset in which bt has been replaced with lst.
- Return type
xr.Dataset