Skip to content

Instantly share code, notes, and snippets.

View jbusecke's full-sized avatar

Julius Busecke jbusecke

View GitHub Profile
@jbusecke
jbusecke / indexing_exercise.ipynb
Created October 25, 2017 16:03
Desktop/indexing_exercise.ipynb
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.
@jbusecke
jbusecke / PU_shared_data.md
Created September 17, 2018 19:03
Dataset storage on tigress at Princeton University

Shared dataset on the princeton HPC filesystems

We often use datasets of a variety of variables (e.g. temperature, salinity, chlorophyll) to validate model runs or conduct analyses.

Ideally, we want to:

  1. avoid storing duplicates of files on the server.
  2. be able to share these datasets with others in the group (downloading and postprocessing is boring).

Our group will be able to get to cool results much quicker if each person takes a bit more time and does the postprocessing

dc_dx = c[:,1:] - c[:,0:-1] / dx[:,1:]
#or was it this way?
dc_dx = c[1:,:] - c[0:-1,:] / dx[1:,:]
...
@jbusecke
jbusecke / pb1.py
Last active October 29, 2020 15:22
Pangeo Blog 1
import intake
import matplotlib.pyplot as plt
import xarray as xr
import numpy as np
import cmocean.cm as cmo
url = "https://raw.githubusercontent.com/NCAR/intake-esm-datastore/master/catalogs/pangeo-cmip6.json"
col = intake.open_esm_datastore(url)
cat = col.search(
table_id='Omon',
grid_label='gn',
@jbusecke
jbusecke / pb2.py
Created October 29, 2020 15:08
Pangeo Blog 2
from dask.distributed import Client, progress
from dask_gateway import Gateway
gateway = Gateway()
cluster = gateway.new_cluster()
cluster.adapt(minimum=2, maximum=12)
cluster
from fastjmd95 import rho
ds['sigma_0'] = rho(ds.so, ds.thetao, 0) - 1000
@jbusecke
jbusecke / pb4.py
Last active October 29, 2020 15:22
ds_section = ds.sel(
time='2010-01',
y=slice(-90,10),
lev=slice(0,1500)
).interp(x=230).squeeze()
@jbusecke
jbusecke / pb5.py
Last active October 29, 2020 15:20
fig, axarr = plt.subplots(nrows=3, figsize=[10,12], sharex=True)
for ax, var, cmap in zip(
axarr.flat,
['thetao', 'so', 'cfc11'],
[cmo.thermal, cmo.haline, cmo.matter]
):
kwargs = dict(yincrease=False, x='lat', y='lev', ax=ax)
# Plot a section along the dateline in 1980 in the southern ocean
# create the grid object
from xgcm import Grid
grid = Grid(
ds,
periodic=False,
coords={'Z':{'center':'lev', 'outer':'lev_outer'}})
grid