This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy as sp | |
import xarray as xr | |
import statsmodels as sm | |
import numpy as np | |
import statsmodels.stats.multitest | |
def mannwhitney(da1, da2, dim="time", global_alpha=0.05): | |
"""xarray wrapper for Mann-Whitney U test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def wrap360(obj, lon='lon'): | |
""" | |
wrap longitude coordinates to 0..360 | |
Parameters | |
---------- | |
obj : xr.Dataset or xr.DataArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lon_to_180(ds, lon_coords="lon"): | |
# https://git.iac.ethz.ch/utility_functions/utility_functions_python/-/blob/master/xarray.py#L149 | |
lon_orig = ds[lon_coords] | |
if lon_orig.ndim != 1: | |
raise ValueError("Currently only handels 1D grids") | |
with xr.set_options(keep_attrs=True): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy as sp | |
import xarray as xr | |
ds = xr.tutorial.open_dataset('air_temperature').load() | |
ds = ds.air | |
xr.__version__ | |
def mannwhitney_(v1, v2): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# configuration | |
dest_env=iacpy3_2019 | |
# change to true to show which packages are installed with 'pip -e' | |
check_devel=false | |
# maybe print hostname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def time_middle_of_month(beg, end=None, periods=None): | |
""" create vector with timestamps in the middle of the month | |
Parameters | |
---------- | |
beg : date or date vector | |
Start date. If end is not given and beg is a vector, uses first | |
entry a start date and last entry as end date. | |
end : date | |
If given used as end date. |