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 itertools | |
def _xy_powers(order): | |
"""Get powers of an x-y polynomial of certain order | |
Order = 2 will have (m, n) for x^m * y^n with m+n <= order | |
Example: | |
>>> _xy_powers(2) | |
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (2, 0)] |
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: mapping | |
channels: | |
- conda-forge | |
- defaults | |
dependencies: | |
- bokeh | |
- bottleneck | |
- cartopy | |
- cftime | |
- click |
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 matplotlib.pyplot as plt | |
# Knobs to twiddle: | |
# 1. sine frequencies: `f1`, `f2` | |
# 2. spacing between vectical bars: `rect_spacing` | |
# (You can also change `rect_width`, but the frequency/spacing are more interesting) | |
f1 = 7.5 # Twiddle with the red sine frequency! | |
f2 = 7.0 # Slightly different frequency |
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 itertools | |
import matplotlib.patheffects as pe | |
import numpy as np | |
def add_zebra_frame(ax, lw=2, crs="pcarree", zorder=None): | |
ax.spines["geo"].set_visible(False) | |
left, right, bot, top = ax.get_extent() | |
# Alternate black and white line segments |
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 time | |
from queue import Empty, Queue | |
from random import random | |
from threading import Event, Thread | |
def _get_data(j, load_time=0.5): | |
"""Simulate data loading taking some amount of time.""" | |
time.sleep(load_time) | |
# adding j just to differentiate the data |
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 h5py | |
class HDF5Explorer: | |
"""Class which maps an HDF5 file and allows tab-completion to explore datasets.""" | |
def __init__(self, hdf5_filepath: str, load_less_than: float = 1e3): | |
self.hdf5_filepath = hdf5_filepath | |
self._hf = h5py.File(hdf5_filepath, "r") | |
self._root_group = HDF5GroupExplorer( | |
self._hf["/"], load_less_than=load_less_than |
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 datetime | |
from pyproj import CRS, Transformer | |
import h5py | |
import isce3 | |
import numpy as np | |
from dolphin._types import Filename | |
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 __future__ import annotations | |
import datetime | |
from typing import Optional, Any | |
import h5netcdf | |
import h5py | |
import numpy as np | |
import pyproj |
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 dolphin.io import load_gdal, get_raster_xysize, get_raster_nodata, get_raster_dtype, get_raster_chunk_size | |
class GDALReader: | |
# https://docs.dask.org/en/stable/generated/dask.array.from_array.html | |
def __init__(self, filename, masked=True): | |
self.filename = filename | |
self._shape = get_raster_xysize(filename)[::-1] | |
self._nodata = get_raster_nodata(filename) | |
self._masked = masked | |
self._dtype = get_raster_dtype(filename) |
OlderNewer