Skip to content

Instantly share code, notes, and snippets.

View dgergel's full-sized avatar

Diana Gergel dgergel

  • Seattle, WA
View GitHub Profile
@dgergel
dgergel / gist:bc7e1a3f0011aca3d82c4d2603a35777
Last active January 5, 2022 01:00
validate ERA-5 precip for a single gridcell
# install packages not already on impactlab server
# !pip install xclim
# ! pip install cdsapi
%matplotlib inline
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import os
@dgergel
dgergel / gist:4d471e6900ac9699e275
Created February 25, 2016 18:02
A few small functions:
def slice_dataset_space(ds_array, ds_to_slice):
'''
slices second Dataset to fit first Dataset
'''
swe_mask_align, array_align = xray.align(ds_array, ds_to_slice, join='inner', copy=False)
return(array_align)
def slice_dataset_time(ds, start_time, end_time):
'''
slices dataset with start and end times