This file contains hidden or 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
| Weighing the loss of the model during training by the MF (Matched Filter, any variant) methane enhancement product. (Somewhat akin to the way boundaries between cells were weighted up in the original U-Net paper.) This method has showned to work well for the STARCOP paper. | |
| Code refs: | |
| - in STARCOP code we cooked these weight files as extra product (now available as the "weight_mag1c.tif" file in https://zenodo.org/records/7863343): https://github.com/spaceml-org/STARCOP/blob/c4789268a3fa0395f92357429052f6f5fc748acb/starcop/data/feature_extration.py#L32 | |
| - in later work we compute these during training (as it's a very fast op), example here in mf_weighing_example.py |
This file contains hidden or 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 matplotlib.pyplot as plt | |
| import rasterio as rio | |
| from georeader.geotensor import GeoTensor | |
| from georeader.save import save_cog | |
| import georeader | |
| from georeader import read | |
| from georeader.rasterio_reader import RasterioReader | |
| from georeader.readers import emit | |
| import numpy as np | |
| import os |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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. |
NewerOlder