Skip to content

Instantly share code, notes, and snippets.

View jasonjewik's full-sized avatar

Jason Jewik jasonjewik

View GitHub Profile
@jasonjewik
jasonjewik / climate_learn_forecasting_quickstart.py
Created May 7, 2023 19:45
Temporary ClimateLearn forecasting quickstart script as we update the documentation. Assumes the data is already downloaded. You must set ROOT_DIR.
from climate_learn.data.climate_dataset.args import ERA5Args
from climate_learn.data.task.args import ForecastingArgs
from climate_learn.data.dataset import MapDatasetArgs
from climate_learn.data import DataModule
from climate_learn.models import load_model, set_climatology
from climate_learn.training import Trainer
import torch
# Load the data
ROOT_DIR = "/path/to/your/data" # CHANGE ME!
@jasonjewik
jasonjewik / sacrilege.py
Created March 23, 2022 22:23
How to make a container class use methods from the objects it contains as if it were its own methods.
# I forgot why I wanted to do this in the first place, but just in case I ever
# need to do something like this again, I'm documenting this horrifying code.
class Cell:
""" Container class """
def __init__(self, capacity):
self.data = [None] * capacity
def __getitem__(self, idx):
return self.data[idx]