Skip to content

Instantly share code, notes, and snippets.

View RandallPittmanOrSt's full-sized avatar

Randall Pittman RandallPittmanOrSt

View GitHub Profile
@RandallPittmanOrSt
RandallPittmanOrSt / check_var_keys.py
Last active July 19, 2024 22:38
Check various keys for netCDF4.Variable.__getitem__
from dataclasses import dataclass
from typing import Any
import netCDF4
import numpy as np
# data
arr1_shape = (3,)
arr2_shape = (3, 10)
arr1 = np.arange(3, dtype=np.int64) + 5
@RandallPittmanOrSt
RandallPittmanOrSt / VarTyping.pyi
Last active July 12, 2024 20:24
Proposal for annotating netCDF4.Variable
from typing import Any, Generic, Literal, Type, TypeVar, Union, overload
from typing_extensions import Self, TypeAlias
import numpy as np
import numpy.typing as npt
# --Just for this example--
import netCDF4
CompoundType = netCDF4.CompoundType