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
class DataNormalizerLogManual(): | |
def __init__(self): | |
self.setup() | |
def setup(self): | |
# These were edited to work with the 10 bands we had in Wildfires project (FireCLR) | |
# only use 10m resolution bands (10): Blue (B2), Green (B3), Red (B4), VNIR (B5), | |
# VNIR (B6), VNIR (B7), NIR (B8), VNIR (B8a), SWIR (B11), SWIR (B12) combining | |
self.BANDS_S2_BRIEF = ["B2", "B3", "B4", "B5", "B6", "B7", "B8", "B8A", "B11", "B12"] |
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
for i in *.pdf ; do ps2pdf "$i" "${i%.*}c.pdf" ; done | |
# for examle this goes from 15.7 MB to 3.9 MB ... without really visibly loosing quality! |
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
def calc_ime(plume_da): | |
molar_volume = 22.4 # L/mol at STP | |
molar_mass_ch4 = 0.01604 #kg/mol | |
kg = plume_da * (1/1e6) * (60*60) * (1000) * (1/molar_volume) * molar_mass_ch4 | |
ime = np.nansum(kg) | |
return ime |
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 os | |
import pytorch_lightning as pl | |
from typing import Optional, Tuple, List | |
import kornia.augmentation as K | |
from torch.utils.data import DataLoader, WeightedRandomSampler | |
from starcop.data import dataset | |
import pandas as pd | |
from . import feature_extration | |
import rasterio.windows |
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
# more in https://github.com/spaceml-org/georeader/blob/main/notebooks/reading_overlapping_sentinel2_aviris.ipynb | |
from georeader.rasterio_reader import RasterioReader | |
from georeader import read | |
def same_location_as_source_from_target(source_tif, target_tif, show=False): | |
src_reader = RasterioReader(source_tif) | |
src_reader_in_memory = src_reader.load() | |
target_reader = RasterioReader(target_tif) |
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 an example file with a plume event | |
# EMIT_L1B_RAD_001_20220823T074504_2223505_021.nc | |
EMIT_wavelenghts = ['381.00558', '388.4092', '395.81583', '403.2254', '410.638', '418.0536', '425.47214', '432.8927', '440.31726', '447.7428', '455.17035', '462.59888', '470.0304', '477.46292', '484.89743', '492.33292', '499.77142', '507.2099', '514.6504', '522.0909', '529.5333', '536.9768', '544.42126', '551.8667', '559.3142', '566.7616', '574.20905', '581.6585', '589.108', '596.55835', '604.0098', '611.4622', '618.9146', '626.36804', '633.8215', '641.2759', '648.7303', '656.1857', '663.6411', '671.09753', '678.5539', '686.0103', '693.4677', '700.9251', '708.38354', '715.84094', '723.2993', '730.7587', '738.2171', '745.6765', '753.1359', '760.5963', '768.0557', '775.5161', '782.97754', '790.4379', '797.89935', '805.36176', '812.8232', '820.2846', '827.746', '835.2074', '842.66986', '850.1313', '857.5937', '865.0551', '872.5176', '879.98004', '887.44147', '894.90393', '902.3664', '909.82886', '917.2913', '924.7538 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
The run.sh bash file should do everything for you, you just need to have an audio sample (in wav format) and the Nvidia docker installed (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker) | |
Download the run.sh command and give it executible rights: | |
chmod +x run.sh | |
Then simply run | |
./run.sh sample.wav 16 | |
This will train a model for 16 epochs and then run an interactive real-time handler with it. |
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 PIL import Image | |
from torchvision import datasets, transforms | |
import torch | |
import torch.utils.data as data | |
import urllib.request | |
import scipy.io | |
import os | |
import imageio | |
import numpy as np | |
from os import listdir |
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
# Based on implementations | |
# - vae core https://github.com/pytorch/examples/blob/master/vae/main.py | |
# - miwae https://github.com/yoonholee/pytorch-vae | |
# - notes on VAE from the article at https://iopscience.iop.org/article/10.3847/PSJ/ab9a52 (but can be taken from elsewhere too) | |
from __future__ import print_function | |
import argparse | |
import torch | |
import torch.utils.data | |
from torch import nn, optim |
NewerOlder