composite(): masking and merging of images (vsm-model 1.1.0)
Browse filesFiles changed (2)
- README.md+19-8
- config.json+17-1
20 unmodified lines21222324242526273 unmodified lines31323334353637383915 unmodified lines5556575558596061626364656667686970575859606171727374753 unmodified lines798081718283848520 unmodified lines## Usage
```bashpip install "git+https://github.com/huizhml/vsm-model@v1.0.0"pip install "git+https://github.com/huizhml/vsm-model@v1.1.0"```
```python3 unmodified linesout = model.predict(s2, x, y, crs="EPSG:32632", variables=["RH25_Q1", "RH98_Q1"])out["rh"] # float32 (n_images, 2, h, w), metresout["land_cover"] # int8 (n_images, h, w)
# one map from several images of the same area, masked and merged as the global VSM mapsrh = model.composite(out["rh"], out["land_cover"], scl) # float32 (2, h, w), NaN where masked```
`predict()` normalises the images, adds the latitude / longitude channels and runs the image15 unmodified lines `Q0` is the 0.95 quantile. `Q1` is the 0.5 quantile. `Q2` is the 0.05 quantile.- `land_cover`: index of the most likely class in 0 unknown, 1 Tree cover, 2 Shrubland, 3 Grassland, 4 Cropland, 5 Built-up, 6 Bare / sparse vegetation, 7 Snow and ice, 8 Permanent water bodies, 9 Herbaceous wetland and mangroves, 10 Moss and lichen, 11 unused.
Nothing is masked: clouds, water and nodata pixels get a prediction like any other pixel.`predict()` returns a prediction for every pixel of every image, also under clouds and on water.
## Masking and merging images
`composite(rh, land_cover, scl)` turns the predictions of several images into one map, with thesteps used for the global VSM maps. `scl` is the Sentinel-2 scene classification of the sameimages, `(n_images, h, w)` at 10 m.
- Per image, pixels with SCL 0, 1, 3, 8, 9, 10, 11 or predicted snow are dropped.- The map is the per-pixel median of the remaining images.- Pixels that are water (SCL or predicted class) or built-up (predicted class) in most images are masked (NaN).
For the global VSM maps, up to 20 images of the growing season were predicted per Sentinel-2tile. Per image, pixels with scene classification (SCL) 0, 1, 3, 8, 9, 10, 11 or predicted snowwere dropped; the map is the per-pixel median of the remaining images. Pixels that are water(SCL or predicted class) or built-up (predicted class) in most images are nodata. The mapsstore decimetres as int16, nodata 32767.For the global maps, up to 20 images of the growing season were used per Sentinel-2 tile. Themaps store decimetres as int16, nodata 32767.
## Weights
3 unmodified lines
| Weights | Code ||---|---|| this version | [vsm-model](https://github.com/huizhml/vsm-model) 1.0.0 (git tag `v1.0.0`) || this version | [vsm-model](https://github.com/huizhml/vsm-model) 1.1.0 (git tag `v1.1.0`) |
## Citation
87 unmodified lines8889909192939495969798991001011021031041051061071081099411011111287 unmodified lines "unused" ] }, "masking": { "scl_nodata": 0, "scl_exclude": [ 0, 1, 3, 8, 9, 10, 11 ], "scl_water": 6, "snow_class": 7, "water_class": 8, "built_up_class": 5 }, "provenance": { "wandb_run": "cg11fpjr", "bias_correction_column": "me_gradual_slope_veg", "code_version": "1.0.0" "code_version": "1.1.0" }}README.md+19-8
config.json+17-1