pysits 2.0.0.dev0__tar.gz → 2.0.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/PKG-INFO +1 -1
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pyproject.toml +1 -1
- pysits-2.0.0.dev1/pysits/docs/content/impute_linear.md +9 -0
- pysits-2.0.0.dev1/pysits/docs/content/impute_mean.md +9 -0
- pysits-2.0.0.dev1/pysits/docs/content/impute_mean_window.md +23 -0
- pysits-2.0.0.dev1/pysits/docs/content/impute_median.md +9 -0
- pysits-2.0.0.dev1/pysits/docs/content/plot.md +112 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_accuracy.md +80 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_accuracy_summary.md +11 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_add_base_cube.md +55 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_apply.md +104 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_as_geopandas.md +28 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_bands.md +30 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_barlow_twins.md +65 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_bbox.md +33 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_classify.md +107 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_clean.md +58 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_cluster_clean.md +22 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_cluster_dendro.md +47 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_cluster_frequency.md +18 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_colors.md +22 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_colors_qgis.md +34 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_colors_reset.md +12 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_colors_set.md +69 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_colors_show.md +14 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_combine_predictions.md +72 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_confidence_sampling.md +54 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_config.md +28 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_config_show.md +13 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_config_user_file.md +19 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_contrastive_learning.md +84 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_cube.md +97 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_cube_copy.md +85 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_encode.md +57 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_formula_linear.md +30 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_formula_logref.md +32 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_geo_dist.md +42 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_get_class.md +56 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_get_data.md +80 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_get_probs.md +53 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_kfold_validate.md +58 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_label_classification.md +91 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_labels.md +35 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_labels_summary.md +16 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_lightgbm.md +42 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_lighttae.md +89 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_list_collections.md +18 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_merge.md +44 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_mixture_model.md +100 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_mlp.md +85 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_model_export.md +20 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_mosaic.md +80 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_parallel.md +38 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_patterns.md +25 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_pre_train.md +51 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_pred_features.md +21 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_pred_normalize.md +21 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_pred_references.md +20 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_pred_sample.md +20 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_predictors.md +13 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_reclassify.md +152 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_reduce.md +63 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_reduce_imbalance.md +51 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_regularize.md +140 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_resnet.md +79 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_rfor.md +37 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_roi_to_tiles.md +45 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_sample.md +27 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_sampling_design.md +47 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_segment.md +91 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_select.md +38 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_show_prediction.md +23 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_slic.md +71 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_smooth.md +90 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_snic.md +60 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_som_clean_samples.md +45 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_som_evaluate_cluster.md +26 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_som_map.md +76 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_ssl_lejepa.md +76 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_ssl_mae.md +91 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_ssl_vicreg.md +87 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_stats.md +21 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_stratified_sampling.md +73 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_svm.md +52 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_tae.md +80 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_tempcnn.md +83 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_texture.md +52 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_tiles_to_roi.md +25 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_timeline.md +15 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_to_csv.md +23 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_to_xlsx.md +42 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_train.md +61 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_tuning.md +61 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_tuning_hparams.md +29 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_uncertainty.md +58 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_uncertainty_sampling.md +62 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_validate.md +61 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_variance.md +50 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_view.md +145 -0
- pysits-2.0.0.dev1/pysits/docs/content/sits_xgboost.md +54 -0
- pysits-2.0.0.dev1/pysits/docs/content/summary.md +36 -0
- pysits-2.0.0.dev0/pysits/docs/content/sits_get_data.md +0 -85
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/.gitattributes +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/.github/workflows/ruff.yaml +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/.gitignore +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/.pre-commit-config.yaml +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/LICENSE +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/README.md +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/conda/meta.yaml +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/backend/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/backend/functions.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/backend/loaders.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/backend/pkgs.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/clojure.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/common.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/decorators.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/dsl/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/dsl/base.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/dsl/mask.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/dsl/tuning.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/stac.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/tibble.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/vector.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/conversions/xarray.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/docs/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/docs/decorators.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/extras/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/extras/earthdatalogin.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/extras/torch.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/jinja.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/base.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/accuracy.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/base.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/cube.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/frame.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/frame_accessor.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/matrix.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/table.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/ts.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/tuning.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/data/vector.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/frame.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/ml.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/models/resolver.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/settings.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/classification.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/colors.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/config.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/context.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/cube.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/data.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/exporters/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/exporters/files.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/exporters/sf.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/exporters/xarray.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/impute.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/ml.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/segment.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/tiles.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/ts.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/tuning.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/utils.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/sits/visualization.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/templates/cube.html +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/templates/tuning.html +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/visualization/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/visualization/base.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/visualization/image.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/visualization/leaflet.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/pysits/visualization/tmap.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/conftest.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_classification.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_config.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_conversions.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_cube.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_data.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_dsl.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_extras.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_geopandas.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_indexing.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_ml_models.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_resolver.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_rl_models.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_tiles.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_tuning.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_utils.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_validation.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_visualization.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/tests/test_xarray.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev1}/uv.lock +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Remove NA using weighted moving average
|
|
2
|
+
|
|
3
|
+
Remove NA using weighted moving average
|
|
4
|
+
|
|
5
|
+
Args:
|
|
6
|
+
data (list): A time series vector or matrix.
|
|
7
|
+
k (int): Width of the moving average window. Expands to both sides
|
|
8
|
+
of the center element e.g. k = 2 means 4 observations (2 left,
|
|
9
|
+
2 right) are taken into account. If all observations in the
|
|
10
|
+
current window are NA, the window size is automatically
|
|
11
|
+
increased until there are at least 2 non-NA values present.
|
|
12
|
+
weighting (str): The weighting strategy to be used. More details
|
|
13
|
+
below (default is "simple").
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
R: A set of filtered time series using the imputation function.
|
|
17
|
+
|
|
18
|
+
Notes:
|
|
19
|
+
The `weighting` parameter defines the weighting strategy used in the
|
|
20
|
+
moving window. The strategies available are:
|
|
21
|
+
- `simple` - Simple Moving Average (SMA) (default option)
|
|
22
|
+
- `linear` - Linear Weighted Moving Average (LWMA)
|
|
23
|
+
- `exponential` - Exponential Weighted Moving Average (EWMA)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Plot sits objects.
|
|
2
|
+
|
|
3
|
+
Unified plotting function that dispatches on the type of the object passed
|
|
4
|
+
as `x`. It mirrors the many `plot` methods of the R `sits` package,
|
|
5
|
+
covering data cubes (raster, SAR, DEM, vector, RGB), probability and
|
|
6
|
+
uncertainty cubes, variance cubes, classified images, time series patterns
|
|
7
|
+
and predictions, machine learning / deep learning models, clustering and
|
|
8
|
+
self-organizing map (SOM) results, accuracy tables, and t-SNE / embedding
|
|
9
|
+
visualizations. The set of accepted keyword arguments depends on the type
|
|
10
|
+
of object being plotted.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
x (SITSCubeModel | SITSTimeSeriesModel | SITSTimeSeriesPatternsModel | SITSMachineLearningMethod | SITSConfusionMatrix): Object to be
|
|
14
|
+
plotted. Supported objects include classified raster images,
|
|
15
|
+
classified segments, digital elevation model cubes, multi-year
|
|
16
|
+
land use/cover embedding predictions, sample distances, class
|
|
17
|
+
temporal patterns, probability cubes, raster, SAR, and vector
|
|
18
|
+
data cubes, confusion matrices / accuracy metrics, dendrograms,
|
|
19
|
+
trained models, time series predictions, t-SNE projections, SOM
|
|
20
|
+
results, uncertainty cubes, and variance cubes.
|
|
21
|
+
y: Ignored. Present for compatibility with the generic `plot`.
|
|
22
|
+
band (str): Band used for plotting a single-band (grey scale) image.
|
|
23
|
+
Applies to raster, SAR, DEM, and vector cubes, and to SOM maps.
|
|
24
|
+
red (str): Band assigned to the red channel of an RGB composite
|
|
25
|
+
(raster, SAR, and vector cubes).
|
|
26
|
+
green (str): Band assigned to the green channel of an RGB composite.
|
|
27
|
+
blue (str): Band assigned to the blue channel of an RGB composite.
|
|
28
|
+
tile (str): Tile to be plotted (data cubes, probability, uncertainty,
|
|
29
|
+
and variance cubes).
|
|
30
|
+
dates (list[str]): Dates to be plotted (raster, SAR, and vector
|
|
31
|
+
cubes).
|
|
32
|
+
roi (dict | geopandas.GeoDataFrame): Spatial extent (region of
|
|
33
|
+
interest) to plot, in WGS 84.
|
|
34
|
+
labels (list[str]): Labels to plot (probability and variance cubes).
|
|
35
|
+
bands (list[str]): Bands to be viewed (patterns and time series
|
|
36
|
+
predictions).
|
|
37
|
+
legend (dict): Associates labels to colors, or a legend specification
|
|
38
|
+
for SOM plots.
|
|
39
|
+
legend_position (str): Where to place the legend (typically "inside"
|
|
40
|
+
or "outside", with defaults varying by plot type).
|
|
41
|
+
legend_title (str): Title of the legend (probability and variance
|
|
42
|
+
cubes).
|
|
43
|
+
palette (str): An RColorBrewer or "cols4all" (or HCL) palette used
|
|
44
|
+
for color mapping.
|
|
45
|
+
rev (bool): Whether to reverse the color order in the palette.
|
|
46
|
+
scale (float): Relative scale of plot text and map (typically 0.4 to
|
|
47
|
+
1.0).
|
|
48
|
+
quantile (float): Minimum quantile to plot (probability and variance
|
|
49
|
+
cubes).
|
|
50
|
+
first_quantile (float): First quantile for stretching images.
|
|
51
|
+
last_quantile (float): Last quantile for stretching images.
|
|
52
|
+
max_cog_size (int): Maximum size of COG (Cloud Optimized GeoTIFF)
|
|
53
|
+
overviews, in lines/columns or pixels.
|
|
54
|
+
seg_color (str): Color used to draw segment boundaries (vector cubes).
|
|
55
|
+
line_width (float): Line width used to draw segment boundaries
|
|
56
|
+
(vector cubes).
|
|
57
|
+
type (str): Type of plot; meaning depends on the object. For accuracy
|
|
58
|
+
objects it is "confusion_matrix" or "metrics"; for variance cubes
|
|
59
|
+
it is "map" or "hist"; for SOM maps it is "codes" or "mapping".
|
|
60
|
+
cluster: Cluster object produced by `sits_cluster_dendro`, used when
|
|
61
|
+
plotting a dendrogram.
|
|
62
|
+
cutree_height (float): Height at which to draw a dashed horizontal
|
|
63
|
+
line indicating where the dendrogram is cut.
|
|
64
|
+
name_cluster (str): Cluster to plot (SOM cluster evaluation).
|
|
65
|
+
title (str): Title of the plot (SOM cluster evaluation).
|
|
66
|
+
year_grid (bool): Whether to plot patterns as a grid of panels with
|
|
67
|
+
labels as columns and years as rows. Defaults to False.
|
|
68
|
+
tree_idx (int): Index of the tree to be plotted for an XGBoost model.
|
|
69
|
+
plot_embedding (str): For embedding predictions, either "none" (plot
|
|
70
|
+
only predicted class intervals) or "area" (overlay a smoothed
|
|
71
|
+
vertical embedding profile per year).
|
|
72
|
+
stretch (tuple[float, float]): For embedding plots, lower/upper
|
|
73
|
+
quantiles used to stretch embedding values before plotting.
|
|
74
|
+
class_alpha (float): Transparency of class polygons in embedding plots
|
|
75
|
+
(0-1).
|
|
76
|
+
area_alpha (float): Transparency of the embedding area in embedding
|
|
77
|
+
plots (0-1).
|
|
78
|
+
area_width (float): Horizontal width fraction of the embedding area.
|
|
79
|
+
area_spar (float): Smoothing parameter for the embedding area spline.
|
|
80
|
+
**kwargs (dict): Further specifications passed to the underlying plot.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
None: A plot is produced. Depending on the input type this may be a
|
|
84
|
+
color map of classified pixels, an RGB or grey-scale image, a
|
|
85
|
+
probability or uncertainty map, a variance map (optionally with
|
|
86
|
+
segment overlays), a dendrogram, a confusion matrix, a SOM map, a
|
|
87
|
+
model diagnostic plot, or a plot for patterns, predictions,
|
|
88
|
+
embeddings, and t-SNE projections. Some methods are called only for
|
|
89
|
+
their side effect of drawing the plot.
|
|
90
|
+
|
|
91
|
+
Notes:
|
|
92
|
+
The `roi` argument can be defined as a `dict` giving the spatial
|
|
93
|
+
extent (for example with `lon_min`, `lon_max`, `lat_min`, `lat_max`),
|
|
94
|
+
a `geopandas.GeoDataFrame`, or another spatial specification accepted
|
|
95
|
+
by `sits`. Vector cube plots overlay the segments produced by
|
|
96
|
+
`sits_segment` on top of the raster image; their appearance is
|
|
97
|
+
controlled by `seg_color` and `line_width`.
|
|
98
|
+
|
|
99
|
+
Examples:
|
|
100
|
+
from pysits import *
|
|
101
|
+
|
|
102
|
+
# Plot a set of time series patterns
|
|
103
|
+
patterns = sits_patterns(cerrado_2classes)
|
|
104
|
+
plot(patterns)
|
|
105
|
+
|
|
106
|
+
# Train a random forest model and plot variable importance
|
|
107
|
+
rfor_model = sits_train(samples_modis_ndvi, ml_method=sits_rfor())
|
|
108
|
+
plot(rfor_model)
|
|
109
|
+
|
|
110
|
+
# Plot a SOM map produced from a set of samples
|
|
111
|
+
som_map = sits_som_map(samples_modis_ndvi)
|
|
112
|
+
plot(som_map)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Assess classification accuracy
|
|
2
|
+
|
|
3
|
+
This function calculates the accuracy of the classification result. The input
|
|
4
|
+
is either a set of classified time series or a classified data cube. Classified
|
|
5
|
+
time series are produced by `sits_classify`. Classified images are generated
|
|
6
|
+
using `sits_classify` followed by `sits_label_classification`.
|
|
7
|
+
For a set of time series, `sits_accuracy` creates a confusion matrix and
|
|
8
|
+
calculates the resulting statistics using package `caret`. For a classified
|
|
9
|
+
image, the function uses an area-weighted technique proposed by Olofsson et al.
|
|
10
|
+
according to references [1-3] to produce reliable accuracy estimates at 95%
|
|
11
|
+
confidence level. In both cases, it provides an accuracy assessment of the
|
|
12
|
+
classified, including Overall Accuracy, Kappa, User's Accuracy, Producer's
|
|
13
|
+
Accuracy and error matrix (confusion matrix).
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
data (SITSCubeModel | SITSTimeSeriesModel): Either a data cube with
|
|
17
|
+
classified images or a set of time series.
|
|
18
|
+
prediction_attr (str): Name of the column of the segments object that
|
|
19
|
+
contains the predicted values (only for vector class cubes).
|
|
20
|
+
reference_attr (str): Name of the column of the segments object that
|
|
21
|
+
contains the reference values (only for vector class cubes).
|
|
22
|
+
validation (str | pathlib.Path | pandas.DataFrame | geopandas.GeoDataFrame | SITSTimeSeriesModel):
|
|
23
|
+
Samples for validation (see below). Only required when data is a
|
|
24
|
+
raster class cube.
|
|
25
|
+
method (str): Either 'olofsson' or 'pixel' to compute accuracy (only
|
|
26
|
+
for raster class cubes).
|
|
27
|
+
**kwargs (dict): Specific parameters.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
SITSData: The error_matrix, the class_areas, the unbiased estimated
|
|
31
|
+
areas, the standard error areas, confidence interval 95 and the accuracy
|
|
32
|
+
(user, producer, and overall), or `None` if the data is empty. The result
|
|
33
|
+
can be visualized directly on the screen.
|
|
34
|
+
|
|
35
|
+
Notes:
|
|
36
|
+
The `validation` data needs to contain the following columns: "latitude",
|
|
37
|
+
"longitude", "start_date", "end_date", and "label". It can be either a path
|
|
38
|
+
to a CSV file, a `SITSTimeSeriesModel`, a `pandas.DataFrame`, or a
|
|
39
|
+
`geopandas.GeoDataFrame`.
|
|
40
|
+
When `validation` is a `geopandas.GeoDataFrame`, the columns "latitude"
|
|
41
|
+
and "longitude" are not required as the locations are extracted from the
|
|
42
|
+
geometry column. The `centroid` is calculated before extracting the
|
|
43
|
+
location values for any geometry type.
|
|
44
|
+
|
|
45
|
+
Examples:
|
|
46
|
+
from pysits import *
|
|
47
|
+
|
|
48
|
+
# show accuracy for a set of samples
|
|
49
|
+
train_data = sits_sample(samples_modis_ndvi, frac=0.5)
|
|
50
|
+
test_data = sits_sample(samples_modis_ndvi, frac=0.5)
|
|
51
|
+
rfor_model = sits_train(train_data, sits_rfor())
|
|
52
|
+
points_class = sits_classify(
|
|
53
|
+
data=test_data, ml_model=rfor_model
|
|
54
|
+
)
|
|
55
|
+
acc = sits_accuracy(points_class)
|
|
56
|
+
|
|
57
|
+
# show accuracy for a data cube classification
|
|
58
|
+
# create a random forest model
|
|
59
|
+
rfor_model = sits_train(samples_modis_ndvi, sits_rfor())
|
|
60
|
+
# create a data cube from local files
|
|
61
|
+
data_dir = r_package_dir("extdata/raster/mod13q1", package="sits")
|
|
62
|
+
cube = sits_cube(
|
|
63
|
+
source="BDC",
|
|
64
|
+
collection="MOD13Q1-6.1",
|
|
65
|
+
data_dir=data_dir
|
|
66
|
+
)
|
|
67
|
+
# classify a data cube
|
|
68
|
+
import tempfile
|
|
69
|
+
probs_cube = sits_classify(
|
|
70
|
+
data=cube, ml_model=rfor_model, output_dir=tempfile.gettempdir()
|
|
71
|
+
)
|
|
72
|
+
# label the probability cube
|
|
73
|
+
label_cube = sits_label_classification(
|
|
74
|
+
probs_cube,
|
|
75
|
+
output_dir=tempfile.gettempdir()
|
|
76
|
+
)
|
|
77
|
+
# obtain the ground truth for accuracy assessment
|
|
78
|
+
ground_truth = r_package_dir("extdata/samples/samples_sinop_crop.csv", package="sits")
|
|
79
|
+
# make accuracy assessment
|
|
80
|
+
as_ = sits_accuracy(label_cube, validation=ground_truth)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Print accuracy summary
|
|
2
|
+
|
|
3
|
+
Adaptation of the caret::print.confusionMatrix method for the more common
|
|
4
|
+
usage in Earth Observation.
|
|
5
|
+
|
|
6
|
+
Args:
|
|
7
|
+
x (SITSConfusionMatrix): accuracy object to summarize.
|
|
8
|
+
digits (int): number of significant digits when printed.
|
|
9
|
+
|
|
10
|
+
Returns:
|
|
11
|
+
SITSData: called for side effects.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Add base maps to a time series data cube
|
|
2
|
+
|
|
3
|
+
This function add base maps to time series data cube. Base maps have
|
|
4
|
+
information that is stable in time (e.g, DEM) which provide relevant
|
|
5
|
+
information for modelling and classification.
|
|
6
|
+
To add a base cube to an existing data cube, they should share the same
|
|
7
|
+
sensor, resolution, bounding box, timeline, and have different bands.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
cube1 (SITSCubeModel): Data cube.
|
|
11
|
+
cube2 (SITSCubeModel): Data cube with base information.
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
SITSCubeModel: a merged data cube with the inclusion of base
|
|
15
|
+
information.
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
from pysits import *
|
|
19
|
+
import tempfile
|
|
20
|
+
import os
|
|
21
|
+
|
|
22
|
+
s2_cube = sits_cube(
|
|
23
|
+
source="MPC",
|
|
24
|
+
collection="SENTINEL-2-L2A",
|
|
25
|
+
tiles="18HYE",
|
|
26
|
+
bands=["B8A", "CLOUD"],
|
|
27
|
+
start_date="2022-01-01",
|
|
28
|
+
end_date="2022-03-31"
|
|
29
|
+
)
|
|
30
|
+
output_dir = os.path.join(tempfile.gettempdir(), "reg")
|
|
31
|
+
if not os.path.exists(output_dir):
|
|
32
|
+
os.makedirs(output_dir)
|
|
33
|
+
dem_cube = sits_cube(
|
|
34
|
+
source="MPC",
|
|
35
|
+
collection="COP-DEM-GLO-30",
|
|
36
|
+
tiles="18HYE",
|
|
37
|
+
bands="ELEVATION"
|
|
38
|
+
)
|
|
39
|
+
s2_reg = sits_regularize(
|
|
40
|
+
cube=s2_cube,
|
|
41
|
+
period="P1M",
|
|
42
|
+
res=240,
|
|
43
|
+
output_dir=output_dir,
|
|
44
|
+
multicores=2,
|
|
45
|
+
memsize=4
|
|
46
|
+
)
|
|
47
|
+
dem_reg = sits_regularize(
|
|
48
|
+
cube=dem_cube,
|
|
49
|
+
res=240,
|
|
50
|
+
tiles="18HYE",
|
|
51
|
+
output_dir=output_dir,
|
|
52
|
+
multicores=2,
|
|
53
|
+
memsize=4
|
|
54
|
+
)
|
|
55
|
+
s2_reg = sits_add_base_cube(s2_reg, dem_reg)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Apply a function on a set of time series
|
|
2
|
+
|
|
3
|
+
Apply a named expression to a set of time series or a data cube to be
|
|
4
|
+
evaluated and generate new bands (indices). In the case of data cubes,
|
|
5
|
+
it creates a new band in `output_dir`.
|
|
6
|
+
|
|
7
|
+
Args:
|
|
8
|
+
data (SITSTimeSeriesModel | SITSCubeModel): valid time series or data
|
|
9
|
+
cube.
|
|
10
|
+
window_size (int): an odd number representing the size of the sliding
|
|
11
|
+
window of kernel functions used in expressions (for a list of
|
|
12
|
+
supported kernel functions, please see details).
|
|
13
|
+
memsize (int): memory available for classification (in GB).
|
|
14
|
+
multicores (int): number of cores to be used for classification.
|
|
15
|
+
normalized (bool): does the expression produce a normalized band?
|
|
16
|
+
output_dir (str | pathlib.Path): directory where files will be saved.
|
|
17
|
+
progress (bool): show progress bar?
|
|
18
|
+
**kwargs (dict): named expressions to be evaluated (see details).
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
SITSFrame: time series or data cube with new bands, produced according
|
|
22
|
+
to the requested expression.
|
|
23
|
+
|
|
24
|
+
Notes:
|
|
25
|
+
The main `sits` classification workflow has the following steps:
|
|
26
|
+
1. `sits_cube`: selects a ARD image collection from a cloud provider.
|
|
27
|
+
2. `sits_cube_copy`: copies an ARD image collection from a cloud provider
|
|
28
|
+
to a local directory for faster processing.
|
|
29
|
+
3. `sits_regularize`: create a regular data cube from an ARD image
|
|
30
|
+
collection.
|
|
31
|
+
4. `sits_apply`: create new indices by combining bands of a regular data
|
|
32
|
+
cube (optional).
|
|
33
|
+
5. `sits_get_data`: extract time series from a regular data cube based on
|
|
34
|
+
user-provided labelled samples.
|
|
35
|
+
6. `sits_train`: train a machine learning model based on image time series.
|
|
36
|
+
7. `sits_classify`: classify a data cube using a machine learning model and
|
|
37
|
+
obtain a probability cube.
|
|
38
|
+
8. `sits_smooth`: post-process a probability cube using a spatial smoother
|
|
39
|
+
to remove outliers and increase spatial consistency.
|
|
40
|
+
9. `sits_label_classification`: produce a classified map by selecting the
|
|
41
|
+
label with the highest probability from a smoothed cube.
|
|
42
|
+
`sits_apply()` allows any valid R expression to compute new bands. Use R
|
|
43
|
+
syntax to pass an expression to this function. Besides arithmetic
|
|
44
|
+
operators, you can use virtually any R function that can be applied to
|
|
45
|
+
elements of a matrix (functions that are unaware of matrix sizes, e.g.
|
|
46
|
+
`sqrt()`, `sin()`, `log()`).
|
|
47
|
+
Examples of valid expressions:
|
|
48
|
+
1. `NDVI = (B08 - B04) / (B08 + B04)` for Sentinel-2 images.
|
|
49
|
+
2. `EVI = 2.5 * (B05 \04) / (B05 + 6 * B04 \7.5 * B02 + 1)` for
|
|
50
|
+
Landsat-8/9 images.
|
|
51
|
+
3. `VV_VH_RATIO = VH/VV` for Sentinel-1 images. In this case, set the
|
|
52
|
+
`normalized` parameter to `False`.
|
|
53
|
+
4. `VV_DB = 10 * log10(VV)` to convert Sentinel-1 RTC images available in
|
|
54
|
+
Planetary Computer to decibels. Also, set the `normalized` parameter to
|
|
55
|
+
`False`.
|
|
56
|
+
`sits_apply()` also accepts a predefined set of kernel functions (see
|
|
57
|
+
below) that can be applied to pixels considering its neighborhood. The
|
|
58
|
+
function considers a neighborhood of a pixel as a set of pixels equidistant
|
|
59
|
+
to it (including itself). This neighborhood forms a square window (also
|
|
60
|
+
known as kernel) around the central pixel (Moore neighborhood). Users can
|
|
61
|
+
set the `window_size` parameter to adjust the size of the kernel window.
|
|
62
|
+
The image is conceptually mirrored at the edges so that neighborhood
|
|
63
|
+
including a pixel outside the image is equivalent to take the 'mirrored'
|
|
64
|
+
pixel inside the edge.
|
|
65
|
+
`sits_apply()` applies a function to the kernel and its result is assigned
|
|
66
|
+
to a corresponding central pixel on a new matrix. The kernel slides
|
|
67
|
+
throughout the input image and this process generates an entire new matrix,
|
|
68
|
+
which is returned as a new band to the cube. The kernel functions ignores
|
|
69
|
+
any `NA` values inside the kernel window. If all pixels in the window are
|
|
70
|
+
`NA` the result will be `NA`.
|
|
71
|
+
By default, the indexes generated by `sits_apply()` function are normalized
|
|
72
|
+
between -1 and 1, scaled by a factor of 0.0001. Normalized indexes are
|
|
73
|
+
saved as INT2S (Integer with sign). If the `normalized` parameter is
|
|
74
|
+
`False`, no scaling factor will be applied and the index will be saved as
|
|
75
|
+
FLT4S (signed float) and the values will vary between -3.4e+38 and
|
|
76
|
+
3.4e+38.
|
|
77
|
+
|
|
78
|
+
Examples:
|
|
79
|
+
from pysits import *
|
|
80
|
+
import tempfile
|
|
81
|
+
|
|
82
|
+
# get a time series
|
|
83
|
+
# Apply a normalization function
|
|
84
|
+
point2 = sits_apply(
|
|
85
|
+
sits_select(point_mt_6bands, "NDVI"),
|
|
86
|
+
NDVI_norm="(NDVI - min(NDVI)) / (max(NDVI) - min(NDVI))"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Example of generation texture band with variance
|
|
90
|
+
# Create a data cube from local files
|
|
91
|
+
data_dir = r_package_dir("extdata/raster/mod13q1", package="sits")
|
|
92
|
+
cube = sits_cube(
|
|
93
|
+
source="BDC",
|
|
94
|
+
collection="MOD13Q1-6.1",
|
|
95
|
+
data_dir=data_dir
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# Generate a texture images with variance in NDVI images
|
|
99
|
+
cube_texture = sits_apply(
|
|
100
|
+
data=cube,
|
|
101
|
+
NDVITEXTURE="w_median(NDVI)",
|
|
102
|
+
window_size=5,
|
|
103
|
+
output_dir=tempfile.mkdtemp()
|
|
104
|
+
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Return time series or a data cube as a `geopandas.GeoDataFrame`.
|
|
2
|
+
|
|
3
|
+
Converts time series or a data cube to a `geopandas.GeoDataFrame`.
|
|
4
|
+
|
|
5
|
+
Args:
|
|
6
|
+
data (SITSTimeSeriesModel | SITSCubeModel): time series or data
|
|
7
|
+
cube.
|
|
8
|
+
crs (str): input coordinate reference system.
|
|
9
|
+
as_crs (str): output coordinate reference system.
|
|
10
|
+
**kwargs (dict): additional parameters.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
SITSFrame: point or polygon geometry.
|
|
14
|
+
|
|
15
|
+
Examples:
|
|
16
|
+
from pysits import *
|
|
17
|
+
|
|
18
|
+
# convert sits tibble to a geopandas object (point)
|
|
19
|
+
geo_object = sits_as_geopandas(cerrado_2classes)
|
|
20
|
+
|
|
21
|
+
# convert sits cube to a geopandas object (polygon)
|
|
22
|
+
data_dir = r_package_dir("extdata/raster/mod13q1", package="sits")
|
|
23
|
+
cube = sits_cube(
|
|
24
|
+
source="BDC",
|
|
25
|
+
collection="MOD13Q1-6.1",
|
|
26
|
+
data_dir=data_dir
|
|
27
|
+
)
|
|
28
|
+
geo_object = sits_as_geopandas(cube)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Get the names of the bands
|
|
2
|
+
|
|
3
|
+
Finds the names of the bands of a set of time series or of a data cube
|
|
4
|
+
|
|
5
|
+
Args:
|
|
6
|
+
x (SITSTimeSeriesModel | SITSCubeModel): time series or data cube.
|
|
7
|
+
value (list[str]): new value for the bands.
|
|
8
|
+
|
|
9
|
+
Returns:
|
|
10
|
+
list: the names of the bands.
|
|
11
|
+
|
|
12
|
+
Examples:
|
|
13
|
+
from pysits import *
|
|
14
|
+
|
|
15
|
+
# Create a data cube from local files
|
|
16
|
+
data_dir = r_package_dir("extdata/raster/mod13q1", package="sits")
|
|
17
|
+
cube = sits_cube(
|
|
18
|
+
source="BDC",
|
|
19
|
+
collection="MOD13Q1-6.1",
|
|
20
|
+
data_dir=data_dir
|
|
21
|
+
)
|
|
22
|
+
# Get the bands from a data cube
|
|
23
|
+
bands = sits_bands(cube)
|
|
24
|
+
# Get the bands from a sits tibble
|
|
25
|
+
bands = sits_bands(samples_modis_ndvi)
|
|
26
|
+
# Get the bands from patterns
|
|
27
|
+
bands = sits_bands(sits_patterns(samples_modis_ndvi))
|
|
28
|
+
# Get the bands from ML model
|
|
29
|
+
rf_model = sits_train(samples_modis_ndvi, sits_rfor())
|
|
30
|
+
bands = sits_bands(rf_model)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Barlow Twins encoder for image time series
|
|
2
|
+
|
|
3
|
+
Supervised pre-training using the Barlow Twins loss and a torch encoder. Two
|
|
4
|
+
time series with the same class label are passed through a shared encoder +
|
|
5
|
+
projector. The Barlow Twins loss makes the cross-correlation matrix of the two
|
|
6
|
+
views' embeddings close to the identity: the diagonal -> 1 (invariance) and the
|
|
7
|
+
off-diagonal -> 0 (redundancy reduction). No negatives are required.
|
|
8
|
+
The function can be used in two ways:
|
|
9
|
+
- If `samples` is provided, it trains immediately and returns an encoder-ready
|
|
10
|
+
model object (see Value).
|
|
11
|
+
- If `samples = None`, it returns a training function with signature
|
|
12
|
+
`function(samples)` that can be passed to `sits_pre_train` or called later.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
samples (SITSTimeSeriesModel): A set of sample time series. If `None`
|
|
16
|
+
(default), returns a training function. If provided, triggers
|
|
17
|
+
immediate training. Base data samples (e.g., `sits_base`) are not
|
|
18
|
+
supported.
|
|
19
|
+
embedding_dim (int): Dimensionality of the encoder embedding (exported
|
|
20
|
+
features). Default: 64.
|
|
21
|
+
proj_dim (int): Dimensionality of the projector head used only during
|
|
22
|
+
pre-training. Default: 256.
|
|
23
|
+
bt_lambda (float): Weight of the redundancy-reduction (off-diagonal)
|
|
24
|
+
term in the Barlow Twins loss. Default: 5e-3.
|
|
25
|
+
num_pairs (int | None): Total number of pairs to form per epoch. When
|
|
26
|
+
`None` (default), one pair is formed for every sample in the
|
|
27
|
+
training split.
|
|
28
|
+
encoder_model (SITSMachineLearningMethod): Deep learning method that
|
|
29
|
+
takes time series as input and produces latent representations that
|
|
30
|
+
are used to compute the loss function (suggested options:
|
|
31
|
+
`sits_tempcnn()`, `sits_lighttae()`, `sits_resnet()`). Default:
|
|
32
|
+
`sits_tempcnn()`.
|
|
33
|
+
epochs (int): Maximum number of training epochs.
|
|
34
|
+
batch_size (int): Batch size for training. Larger values improve the
|
|
35
|
+
Barlow Twins cross-correlation estimate. Default: 128.
|
|
36
|
+
validation_split (float): Fraction of samples held out for validation
|
|
37
|
+
loss monitoring, in the range (0, 1).
|
|
38
|
+
optimizer: A `torch` optimizer constructor (default:
|
|
39
|
+
`torch::optim_adamw`).
|
|
40
|
+
opt_hparams (dict): Optimizer hyperparameters. Common entries: `lr`,
|
|
41
|
+
`eps`, `weight_decay`.
|
|
42
|
+
lr_decay_epochs (int): Step size (in epochs) for LR decay.
|
|
43
|
+
lr_decay_rate (float): Multiplicative LR decay factor.
|
|
44
|
+
patience (int): Early-stopping patience (epochs without improvement).
|
|
45
|
+
min_delta (float): Minimum improvement required to reset the patience
|
|
46
|
+
counter.
|
|
47
|
+
verbose (bool): Print training progress?
|
|
48
|
+
seed (int): Random seed for reproducibility.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
R: If `samples = None`, a training function with signature
|
|
52
|
+
`function(samples)` that trains a Barlow Twins model and returns a
|
|
53
|
+
pretrained encoder. If `samples` is provided, the result of applying the
|
|
54
|
+
training function to `samples` directly.
|
|
55
|
+
|
|
56
|
+
Examples:
|
|
57
|
+
from pysits import *
|
|
58
|
+
|
|
59
|
+
model = sits_pre_train(
|
|
60
|
+
samples_modis_ndvi,
|
|
61
|
+
sits_barlow_twins(
|
|
62
|
+
embedding_dim=32,
|
|
63
|
+
epochs=20
|
|
64
|
+
)
|
|
65
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Get the bounding box of the data
|
|
2
|
+
|
|
3
|
+
Obtain a vector of limits (either on lat/long for time series or in
|
|
4
|
+
projection coordinates in the case of cubes)
|
|
5
|
+
|
|
6
|
+
Args:
|
|
7
|
+
data (SITSTimeSeriesModel | SITSCubeModel): samples or data cube.
|
|
8
|
+
crs (str): CRS of the time series.
|
|
9
|
+
as_crs (str): CRS to project the resulting bounding box.
|
|
10
|
+
**kwargs (dict): parameters for specific types.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
SITSFrame: the bounding box.
|
|
14
|
+
|
|
15
|
+
Notes:
|
|
16
|
+
Time series in `sits` are associated with lat/long values in WGS84,
|
|
17
|
+
while each data cube is associated to a cartographic projection. To
|
|
18
|
+
obtain the bounding box of a data cube in a different projection than
|
|
19
|
+
the original, use the `as_crs` parameter.
|
|
20
|
+
|
|
21
|
+
Examples:
|
|
22
|
+
from pysits import *
|
|
23
|
+
|
|
24
|
+
# get the bbox of a set of samples
|
|
25
|
+
sits_bbox(samples_modis_ndvi)
|
|
26
|
+
# get the bbox of a cube in WGS84
|
|
27
|
+
data_dir = r_package_dir("extdata/raster/mod13q1", package="sits")
|
|
28
|
+
cube = sits_cube(
|
|
29
|
+
source="BDC",
|
|
30
|
+
collection="MOD13Q1-6.1",
|
|
31
|
+
data_dir=data_dir
|
|
32
|
+
)
|
|
33
|
+
sits_bbox(cube, as_crs="EPSG:4326")
|