Skip to content

Instantly share code, notes, and snippets.

@nilsleh
nilsleh / dynamic_earthnet_metadata.csv
Created March 20, 2025 06:23
dynamic earthnet metadat and paths
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 9 columns, instead of 6 in line 4.
split,planet_path,label_path,year_month,missing_label,s1_path,s2_path,missing_s1,missing_s2
train,planet/10N/23E-188N/1311_3077_13/PF-SR,labels/1311_3077_13_10N/Labels/Raster/10N-122W-40N-L3H-SR/10N-122W-40N-L3H-SR-2018_01_01.tif,2018-01,False,sentinel1/1311_3077_13/1311_3077_13_2018_01.tif,sentinel2/1311_3077_13/2018_01.tif,False,False
train,planet/10N/23E-188N/1311_3077_13/PF-SR,labels/1311_3077_13_10N/Labels/Raster/10N-122W-40N-L3H-SR/10N-122W-40N-L3H-SR-2018_02_01.tif,2018-02,False,sentinel1/1311_3077_13/1311_3077_13_2018_02.tif,sentinel2/1311_3077_13/2018_02.tif,False,False
train,planet/10N/23E-188N/1311_3077_13/PF-SR,labels/1311_3077_13_10N/Labels/Raster/10N-122W-40N-L3H-SR/10N-122W-40N-L3H-SR-2018_03_01.tif,2018-03,False,sentinel1/1311_3077_13/1311_3077_13_2018_03.tif,sentinel2/1311_3077_13/2018_03.tif,False,False
train,planet/10N/23E-188N/1311_3077_13/PF-SR,labels/1311_3077_13_10N/Labels/Raster/10N-122W-40N-L3H-SR/10N-122W-40N-L3H-SR-2018_04_01.tif,2018-04,False,sentinel1/1311_3077_13/1311_3077_13_201
@nilsleh
nilsleh / config.yaml
Last active November 19, 2024 18:21
Oceanbench osse_gf_nadir_sst reproduce
train_patcher_kw:
patches:
time: 15
lon: 200
lat: 200
strides:
time: 1
lon: 50
lat: 50
domain_limits:
@nilsleh
nilsleh / config.yaml
Created September 17, 2024 12:17
Hyperparam tuning with optuna
experiment:
experiment_name: "eurosat"
exp_dir: "/mnt/SSD2/nils/projects/hyper_param/results"
wandb:
project: eurosat_hparam
entity: nleh
mode: offline
model:
_target_: lightning_uq_box.uq_methods.DeterministicClassification
@nilsleh
nilsleh / inpainting.py
Created May 22, 2024 14:22
Inpainting procedure with DDPM and RePaint
from glob import glob
import os
import matplotlib.pyplot as plt
import torch
from denoising_diffusion_pytorch import Unet
from denoising_diffusion_pytorch.repaint import GaussianDiffusion as RePaint
from PIL import Image
from torch.utils.data import DataLoader
from torchvision.datasets import VisionDataset
@nilsleh
nilsleh / min_example.py
Last active April 9, 2024 09:26
DeepSensor Reproducable Example
from typing import Any
import deepsensor.torch
import numpy as np
import xarray as xr
from deepsensor.data.loader import TaskLoader
from deepsensor.data.processor import DataProcessor
from deepsensor.train import Trainer
from hydra.utils import instantiate
from omegaconf import DictConfig, OmegaConf
@nilsleh
nilsleh / laplace_example.py
Last active January 23, 2024 07:44
Laplace Example Constant UQ Reproduce
import os
from functools import lru_cache
from typing import Any, Dict, Optional
import kornia.augmentation as K
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import timm
import torch
@nilsleh
nilsleh / ocean_bench_datamodule.py
Last active January 16, 2024 15:44
Ocean Bench Lightning Datamodule
"""Ocean Bench Datamodules."""
import itertools
import os
from collections import namedtuple
from typing import Any
import hydra
import numpy as np
import ocn_tools._src.geoprocessing.gridding as obgrid
@nilsleh
nilsleh / raps.py
Last active January 11, 2024 15:06
Compare RAPS implementations
import os
from typing import Sequence
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from lightning import Trainer
from lightning.pytorch import seed_everything
from orig_conformal import ConformalModel
@nilsleh
nilsleh / retrieve_milestone_contributors.py
Created November 10, 2023 13:18
Retrieve the contributors from a milestone
import requests
# Set up authentication with your PAT
headers = {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
# Define the repository information
repo_owner = 'repo_owner'
repo_name = 'repo_name'
@nilsleh
nilsleh / 1d regression_swag.ipynb
Last active February 26, 2023 16:34
SWAG 1D Regression example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.