Skip to content

Instantly share code, notes, and snippets.

View rabernat's full-sized avatar

Ryan Abernathey rabernat

View GitHub Profile
@rabernat
rabernat / osn.md
Created October 27, 2020 14:20
Guide to using Open Storage Network for Zarr data

Using OSN with Zarr

This is a rough guide to using the OSN object storage service with Zarr data.

Background Information

Open Storage Network

Open Storage Network (OSN) is a distributed data service to support active data sharing and transfer between academic institutions, leveraging existing NSF-funded resources. It is funded by NSF and the Schmidt Futures Foundation.

@rabernat
rabernat / detrend_xarray.py
Last active December 18, 2024 05:21
Detrend xarray DataArrays using polyfit
import xarray as xr
def detrend_dim(da, dim, deg=1):
# detrend along a single dimension
p = da.polyfit(dim=dim, deg=deg)
fit = xr.polyval(dim, p.polyfit_coefficients)
return da - fit
def detrend(da, dims, deg=1):
# detrend along multiple dimensions
@rabernat
rabernat / gist:f59692c30c6a448ef0ab60dd3cd465d6
Created September 24, 2020 02:56
Rechunker with prefect via dask executor
r = rechunk(array, target_chunks, max_mem,
store_target, temp_store=store_tmp, executor='prefect')
flow = r.plan
import datetime
for task in flow.tasks:
task.max_retries = 10
task.retry_delay = datetime.timedelta(seconds=5)
from prefect.engine.executors import DaskExecutor
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.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rabernat
rabernat / 03_computation_LIVE_CODE.ipynb
Created July 9, 2020 16:59
From the Xarray SciPy tutorial
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rabernat
rabernat / extract_and_install.sh
Last active June 26, 2020 13:28
Pangeo homedir migration scripts
#!/bin/bash
PERM="gke-2a8e5e49b2ab578131da:google-sudoers"
NEWUID=$1
ORCID=$2
ARCHIVE=$3
SRC="mnt/nfs/home/ocean.pangeo.io/$ORCID"
TAR="/mnt/nfs/uscentral1b/$NEWUID"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.