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 | |
import xarray as xr | |
from xclim import sdba | |
def _datafactory( | |
x, start_time="1950-01-01", variable_name="fakevariable", lon=1.0, lat=1.0 | |
): | |
"""Populate xr.Dataset with synthetic data for testing""" | |
start_time = str(start_time) | |
if x.ndim != 1: |
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 censor(x): | |
if x < 1: | |
return np.random.uniform(low=0.5, high=1) | |
else: | |
return x | |
vcensor = np.vectorize(censor) | |
ds_corrected = xr.apply_ufunc(vcensor, ds, dask='parallelized') # rather, should we load the data before hand ? | |
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 xarray as xr | |
import numpy as np | |
### Fake data ### | |
def spatio_temporal_gcm_factory( | |
x=np.random.rand(1, 361, 721), | |
start_date="1995-01-01", | |
lat=np.arange(-90, 90.5, 0.5), | |
lon=np.arange(-180, 180.5, 0.5), |
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
from yaml import load, dump, Loader | |
fp = '/Users/emile/Desktop/testyaml.yaml' | |
out = { | |
'a': 1 | |
} | |
with open(fp, 'w') as f: | |
dump(out, f) | |
with open(fp, 'r') as f: |
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
### This works ##### | |
FILEPATTERN = '...' | |
def func(ds): | |
var = next(var for var in ds) | |
fp = ds[var].encoding['source'] | |
coordds = ds.assign_coords(path=fp) | |
dimds = coordds.expand_dims('path') | |
return dimds | |
fs = fsspec.filesystem('gs') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
name: explore-sentinel1-rtc | |
channels: | |
- conda-forge | |
- defaults | |
dependencies: | |
- python=3.10 | |
- ipykernel | |
- pip | |
- pip: | |
- stackstac |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# set ARN_MFA_DEVICE to the ARN of the MFA device associated with your SMCE account. | |
# and AWS_PROFILE to your AWS credentials profile associated with the SMCE MAAP account (in ~/.aws/credentials) | |
# first argument (positional) of this function is the MFA code that is displayed by your MFA app at the moment | |
# you run the function (e.g. Google Auth) | |
mfa_authentication_smce_maap () { | |
export AWS_PROFILE="YOUR_SMCE_MAAP_PROFILE" | |
export ARN_MFA_DEVICE="ARN_OF_MFA_DEVICE" | |
tokens=$(aws sts get-session-token --serial-number $ARN_MFA_DEVICE --token-code $1 --output json) |
OlderNewer