Skip to content

Instantly share code, notes, and snippets.

View RichardScottOZ's full-sized avatar

RichardScottOZ

  • Australia
View GitHub Profile
@rmg55
rmg55 / stackstac_NASA_HLS.ipynb
Created March 12, 2021 19:40
using stackstac with NASA HLS S30 catalog
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@scottyhq
scottyhq / stackstac-nsidc0723.ipynb
Created April 19, 2021 12:23
stackstac with nsidc data
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.
@Hoeze
Hoeze / xarray_boolean_indexing_v2.py
Last active February 19, 2024 13:38
xarray boolean indexing v2
from typing import List, Dict, Tuple
import xarray as xr
import numpy as np
import dask.array
# import pandas as pd
# def core_dim_locs_from_multiindex(multi_index, coords: Dict[str, pd.Index], new_dim_name, core_dims=None) -> List[
# Tuple[str, xr.DataArray]]:

Holy grail

Before diving too deeply into the various friction points when working with archives of earth observation data in xarray, let's look at a more optimal case from the earth systems world. In the notebook here we demonstrate how using zarr's consolidated metadata option to access the dimensional and chunk reference information, a massive dataset's dimensions and variables can be loaded extremely quickly. With this consolidated metadata available to reference chunks on disk, we can leverage xarray's dask integration to use normal xarray operations to lazily load chunks in parallel and perform our calculations using dask's blocked algorithm implementations. Gravy.

Challenges

But the earth observation story is more complicated... Not everything lives in standardized file containers and more importantly our grid coordinate systems are "all over the map" :] Here are some of the current challenges.

  1. Consolida
@alexgleith
alexgleith / esri_mess.ipynb
Created June 26, 2021 04:40
Find all the possible ESRI Land Cover scene and put them in a big list.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pymc3 as pm
import numpy as np
import arviz as az
%config InlineBackend.figure_format = 'retina'
# Data from https://twitter.com/tomstafford/status/1456914037195907079?s=20
N = np.array([1258, 280]) # total number of caffiene and non-caffiene drinkers
k = np.array([966, 168]) # total number of those who have favourite mugs
def cohens_h(p):
@kwinkunks
kwinkunks / SOM.ipynb
Last active November 14, 2021 20:27
Self-organizing maps of seismic
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aaronspring
aaronspring / vectorized_sklearn_xr.ipynb
Last active April 27, 2024 19:05
vectorized `sklearn` with `xarray`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rsignell-usgs
rsignell-usgs / conus404_consolidated_zarr.ipynb
Created February 3, 2022 14:51
conus404_consolidated_zarr.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.