For a version without the collapsible details sections (so you can search the whole thing in your browser), click here.
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 tiktoken | |
import langdetect | |
T = tiktoken.get_encoding("o200k_base") | |
length_dict = {} | |
for i in range(T.n_vocab): | |
try: | |
length_dict[i] = len(T.decode([i])) | |
except: |
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 asyncio | |
import functools | |
from typing import Any, Coroutine | |
loop = asyncio.new_event_loop() | |
def run(async_coroutine: Coroutine[Any, Any, Any]): | |
""" | |
Convert an async method to a synchronous one. |
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
apiVersion: argoproj.io/v1alpha1 | |
kind: Workflow | |
metadata: | |
generateName: papermill-test- | |
spec: | |
entrypoint: main | |
templates: | |
- name: main | |
inputs: |
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
apiVersion: argoproj.io/v1alpha1 | |
kind: Workflow | |
metadata: | |
generateName: dask-internal-process-demo- | |
spec: | |
entrypoint: dask | |
activeDeadlineSeconds: 1800 # Safety first, kids! | |
templates: | |
- name: dask | |
script: |
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
# Get tasmin, tasmax parameter files for each GCM and combine to create DTR parameter file. | |
# This is all rough and likely to break. Sorry. | |
import logging | |
import pathlib | |
import dearprudence | |
import dearprudence.validation | |
PARAMS_DIR = pathlib.Path("/Users/bmalevich/Projects/downscaleCMIP6/workflows/parameters") |
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 xarray as xr | |
def add_cyclic(ds, dim): | |
""" | |
Adds wrap-around, appending first value to end of data for named dimension. | |
Basically an xarray version of ``cartopy.util.add_cyclic_point()``. | |
""" | |
return ds.map( |
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
""" | |
Demo using cartopy.util.add_cyclic_point with an xarray Dataset to | |
add a cyclic or wrap-around pixel to the `lon` dimension. This can be useful | |
for plotting with `cartopy` or regridding with `xesmf`. | |
""" | |
import xarray as xr | |
from cartopy.util import add_cyclic_point | |
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
apiVersion: argoproj.io/v1alpha1 | |
kind: Workflow | |
metadata: | |
generateName: dask-test- | |
spec: | |
entrypoint: dask | |
activeDeadlineSeconds: 1800 # Safety first, kids! | |
templates: | |
- name: dask | |
script: |
NewerOlder