pysits 2.0.0.dev0__tar.gz → 2.0.0.dev2__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.dev2/.claude/settings.local.json +8 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/PKG-INFO +1 -1
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pyproject.toml +1 -1
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/__init__.py +29 -12
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/tibble.py +2 -1
- pysits-2.0.0.dev2/pysits/docs/content/impute_linear.md +10 -0
- pysits-2.0.0.dev2/pysits/docs/content/impute_mean.md +9 -0
- pysits-2.0.0.dev2/pysits/docs/content/impute_mean_window.md +23 -0
- pysits-2.0.0.dev2/pysits/docs/content/impute_median.md +9 -0
- pysits-2.0.0.dev2/pysits/docs/content/plot.md +117 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_accuracy.md +81 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_accuracy_summary.md +11 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_add_base_cube.md +55 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_apply.md +102 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_as_geopandas.md +28 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_bands.md +30 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_barlow_twins.md +63 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_bbox.md +33 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_classify.md +88 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_clean.md +58 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_cluster_clean.md +22 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_cluster_dendro.md +48 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_cluster_frequency.md +18 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_colors.md +22 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_colors_qgis.md +36 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_colors_reset.md +12 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_colors_set.md +69 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_colors_show.md +16 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_combine_predictions.md +73 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_confidence_sampling.md +55 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_config.md +29 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_config_show.md +13 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_config_user_file.md +18 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_contrastive_learning.md +84 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_cube.md +80 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_cube_copy.md +88 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_encode.md +54 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_formula_linear.md +30 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_formula_logref.md +32 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_geo_dist.md +43 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_get_class.md +55 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_get_data.md +57 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_get_probs.md +51 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_kfold_validate.md +59 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_label_classification.md +90 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_labels.md +35 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_labels_summary.md +16 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_lightgbm.md +48 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_lighttae.md +90 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_list_collections.md +18 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_lstm_fcn.md +76 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_merge.md +44 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_mixture_model.md +100 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_mlp.md +85 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_model_export.md +20 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_mosaic.md +84 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_parallel.md +52 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_patterns.md +25 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_pre_train.md +51 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_pred_features.md +21 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_pred_normalize.md +21 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_pred_references.md +20 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_pred_sample.md +20 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_predictors.md +13 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_random_sampling.md +30 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_reclassify.md +146 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_reduce.md +62 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_reduce_imbalance.md +51 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_regularize.md +140 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_resnet.md +79 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_rfor.md +37 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_roi_to_tiles.md +45 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_sample.md +27 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_sampling_design.md +45 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_sankey.md +60 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_segment.md +90 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_select.md +35 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_show_prediction.md +23 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_slic.md +71 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_smooth.md +90 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_snic.md +60 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_som_clean_samples.md +45 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_som_evaluate_cluster.md +25 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_som_map.md +75 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_som_remove_samples.md +28 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_ssl_lejepa.md +76 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_ssl_mae.md +94 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_ssl_vicreg.md +82 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_stats.md +20 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_stratified_sampling.md +74 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_svm.md +53 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_tae.md +79 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_tempcnn.md +87 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_texture.md +54 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_tiles_to_roi.md +25 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_timeline.md +16 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_timeseries_to_csv.md +23 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_to_csv.md +22 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_to_xlsx.md +42 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_train.md +61 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_tuning.md +61 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_tuning_hparams.md +29 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_uncertainty.md +58 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_uncertainty_sampling.md +64 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_validate.md +61 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_variance.md +50 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_view.md +142 -0
- pysits-2.0.0.dev2/pysits/docs/content/sits_xgboost.md +54 -0
- pysits-2.0.0.dev2/pysits/docs/content/summary.md +42 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/frame.py +16 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/data.py +30 -1
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/exporters/__init__.py +2 -1
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/exporters/files.py +6 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/ml.py +10 -6
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/ts.py +12 -6
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/visualization.py +9 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/visualization/base.py +8 -1
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/conftest.py +48 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_classification.py +13 -14
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_cube.py +57 -12
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_data.py +7 -27
- pysits-2.0.0.dev2/tests/test_embedding.py +251 -0
- pysits-2.0.0.dev2/tests/test_exporters.py +96 -0
- pysits-2.0.0.dev0/tests/test_geopandas.py → pysits-2.0.0.dev2/tests/test_exporters_geopandas.py +3 -17
- pysits-2.0.0.dev0/tests/test_xarray.py → pysits-2.0.0.dev2/tests/test_exporters_xarray.py +14 -27
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_ml_models.py +41 -2
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_rl_models.py +36 -0
- pysits-2.0.0.dev2/tests/test_som.py +103 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_visualization.py +87 -19
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/uv.lock +1 -1
- pysits-2.0.0.dev0/pysits/docs/content/sits_get_data.md +0 -85
- pysits-2.0.0.dev0/pysits/sits/classification.py +0 -42
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/.gitattributes +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/.github/workflows/ruff.yaml +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/.gitignore +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/.pre-commit-config.yaml +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/LICENSE +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/README.md +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/conda/meta.yaml +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/backend/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/backend/functions.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/backend/loaders.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/backend/pkgs.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/clojure.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/common.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/decorators.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/dsl/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/dsl/base.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/dsl/mask.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/dsl/tuning.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/stac.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/vector.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/conversions/xarray.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/docs/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/docs/decorators.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/extras/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/extras/earthdatalogin.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/extras/torch.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/jinja.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/base.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/accuracy.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/base.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/cube.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/frame_accessor.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/matrix.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/table.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/ts.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/tuning.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/data/vector.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/frame.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/ml.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/models/resolver.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/settings.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/colors.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/config.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/context.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/cube.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/exporters/sf.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/exporters/xarray.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/impute.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/segment.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/tiles.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/tuning.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/sits/utils.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/templates/cube.html +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/templates/tuning.html +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/visualization/__init__.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/visualization/image.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/visualization/leaflet.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/pysits/visualization/tmap.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_config.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_conversions.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_dsl.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_extras.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_indexing.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_resolver.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_tiles.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_tuning.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_utils.py +0 -0
- {pysits-2.0.0.dev0 → pysits-2.0.0.dev2}/tests/test_validation.py +0 -0
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
from .conversions.dsl.mask import MaskValue
|
|
21
21
|
from .conversions.dsl.tuning import hparam
|
|
22
22
|
from .settings import __version__
|
|
23
|
-
from .sits.classification import sits_classify, sits_label_classification, sits_smooth
|
|
24
23
|
from .sits.colors import (
|
|
25
24
|
sits_colors,
|
|
26
25
|
sits_colors_reset,
|
|
@@ -62,6 +61,9 @@ from .sits.data import (
|
|
|
62
61
|
sits_apply,
|
|
63
62
|
sits_bands,
|
|
64
63
|
sits_bbox,
|
|
64
|
+
sits_classify,
|
|
65
|
+
sits_encode,
|
|
66
|
+
sits_label_classification,
|
|
65
67
|
sits_labels,
|
|
66
68
|
sits_labels_summary,
|
|
67
69
|
sits_list_collections,
|
|
@@ -69,10 +71,17 @@ from .sits.data import (
|
|
|
69
71
|
sits_mixture_model,
|
|
70
72
|
sits_reduce,
|
|
71
73
|
sits_select,
|
|
74
|
+
sits_smooth,
|
|
72
75
|
sits_timeline,
|
|
73
76
|
)
|
|
74
77
|
from .sits.data import sits_summary as summary
|
|
75
|
-
from .sits.exporters import
|
|
78
|
+
from .sits.exporters import (
|
|
79
|
+
sits_as_geopandas,
|
|
80
|
+
sits_as_xarray,
|
|
81
|
+
sits_timeseries_to_csv,
|
|
82
|
+
sits_to_csv,
|
|
83
|
+
sits_to_xlsx,
|
|
84
|
+
)
|
|
76
85
|
from .sits.impute import (
|
|
77
86
|
impute_linear,
|
|
78
87
|
impute_mean,
|
|
@@ -87,6 +96,7 @@ from .sits.ml import (
|
|
|
87
96
|
sits_kfold_validate,
|
|
88
97
|
sits_lightgbm,
|
|
89
98
|
sits_lighttae,
|
|
99
|
+
sits_lstm_fcn,
|
|
90
100
|
sits_mlp,
|
|
91
101
|
sits_model_export,
|
|
92
102
|
sits_pre_train,
|
|
@@ -107,7 +117,6 @@ from .sits.ts import (
|
|
|
107
117
|
sits_cluster_clean,
|
|
108
118
|
sits_cluster_dendro,
|
|
109
119
|
sits_cluster_frequency,
|
|
110
|
-
sits_encode,
|
|
111
120
|
sits_geo_dist,
|
|
112
121
|
sits_get_class,
|
|
113
122
|
sits_get_data,
|
|
@@ -118,6 +127,7 @@ from .sits.ts import (
|
|
|
118
127
|
sits_pred_references,
|
|
119
128
|
sits_pred_sample,
|
|
120
129
|
sits_predictors,
|
|
130
|
+
sits_random_sampling,
|
|
121
131
|
sits_reduce_imbalance,
|
|
122
132
|
sits_sample,
|
|
123
133
|
sits_sampling_design,
|
|
@@ -125,6 +135,7 @@ from .sits.ts import (
|
|
|
125
135
|
sits_som_clean_samples,
|
|
126
136
|
sits_som_evaluate_cluster,
|
|
127
137
|
sits_som_map,
|
|
138
|
+
sits_som_remove_samples,
|
|
128
139
|
sits_stats,
|
|
129
140
|
sits_stratified_sampling,
|
|
130
141
|
sits_validate,
|
|
@@ -137,13 +148,21 @@ from .sits.utils import (
|
|
|
137
148
|
read_rds,
|
|
138
149
|
)
|
|
139
150
|
from .sits.visualization import sits_plot as plot
|
|
140
|
-
from .sits.visualization import sits_view
|
|
151
|
+
from .sits.visualization import sits_sankey, sits_view
|
|
141
152
|
|
|
142
153
|
__all__ = (
|
|
143
154
|
# Classification
|
|
144
155
|
"sits_classify",
|
|
145
156
|
"sits_smooth",
|
|
146
157
|
"sits_label_classification",
|
|
158
|
+
# Embeddings
|
|
159
|
+
"sits_pre_train",
|
|
160
|
+
"sits_encode",
|
|
161
|
+
"sits_ssl_mae",
|
|
162
|
+
"sits_ssl_lejepa",
|
|
163
|
+
"sits_ssl_vicreg",
|
|
164
|
+
"sits_barlow_twins",
|
|
165
|
+
"sits_contrastive_learning",
|
|
147
166
|
# Cube
|
|
148
167
|
"sits_cube",
|
|
149
168
|
"sits_clean",
|
|
@@ -170,7 +189,7 @@ __all__ = (
|
|
|
170
189
|
"sits_config_user_file",
|
|
171
190
|
"sits_config_value",
|
|
172
191
|
"sits_parallel",
|
|
173
|
-
# Data
|
|
192
|
+
# Data
|
|
174
193
|
"sits_bands",
|
|
175
194
|
"sits_timeline",
|
|
176
195
|
"sits_labels",
|
|
@@ -194,6 +213,7 @@ __all__ = (
|
|
|
194
213
|
"sits_resnet",
|
|
195
214
|
"sits_tempcnn",
|
|
196
215
|
"sits_lighttae",
|
|
216
|
+
"sits_lstm_fcn",
|
|
197
217
|
"sits_svm",
|
|
198
218
|
"sits_xgboost",
|
|
199
219
|
"sits_lightgbm",
|
|
@@ -202,12 +222,6 @@ __all__ = (
|
|
|
202
222
|
"sits_model_export",
|
|
203
223
|
"sits_formula_linear",
|
|
204
224
|
"sits_formula_logref",
|
|
205
|
-
"sits_ssl_mae",
|
|
206
|
-
"sits_ssl_lejepa",
|
|
207
|
-
"sits_ssl_vicreg",
|
|
208
|
-
"sits_barlow_twins",
|
|
209
|
-
"sits_contrastive_learning",
|
|
210
|
-
"sits_pre_train",
|
|
211
225
|
# Impute
|
|
212
226
|
"impute_linear",
|
|
213
227
|
"impute_mean",
|
|
@@ -228,13 +242,14 @@ __all__ = (
|
|
|
228
242
|
"sits_som_map",
|
|
229
243
|
"sits_som_evaluate_cluster",
|
|
230
244
|
"sits_som_clean_samples",
|
|
245
|
+
"sits_som_remove_samples",
|
|
231
246
|
"sits_geo_dist",
|
|
232
247
|
"sits_patterns",
|
|
233
248
|
"sits_sample",
|
|
234
249
|
"sits_reduce_imbalance",
|
|
235
250
|
"sits_sampling_design",
|
|
236
251
|
"sits_stratified_sampling",
|
|
237
|
-
"
|
|
252
|
+
"sits_random_sampling",
|
|
238
253
|
# Tiles
|
|
239
254
|
"sits_tiles_to_roi",
|
|
240
255
|
"sits_roi_to_tiles",
|
|
@@ -249,12 +264,14 @@ __all__ = (
|
|
|
249
264
|
"sits_as_xarray",
|
|
250
265
|
"sits_as_geopandas",
|
|
251
266
|
"sits_to_xlsx",
|
|
267
|
+
"sits_timeseries_to_csv",
|
|
252
268
|
# Tuning
|
|
253
269
|
"sits_tuning_hparams",
|
|
254
270
|
"sits_tuning",
|
|
255
271
|
# Visualization
|
|
256
272
|
"plot",
|
|
257
273
|
"sits_view",
|
|
274
|
+
"sits_sankey",
|
|
258
275
|
# DSL Variables
|
|
259
276
|
"MaskValue",
|
|
260
277
|
"hparam",
|
|
@@ -480,7 +480,8 @@ def geopandas_to_tibble(data: GeoPandasDataFrame) -> RDataFrame:
|
|
|
480
480
|
f"Warning: Dropping columns with embedded DataFrames: {dropped_columns}"
|
|
481
481
|
)
|
|
482
482
|
|
|
483
|
-
|
|
483
|
+
# Geometries are transferred as WKT, so the result is a plain data frame
|
|
484
|
+
data_safe = PandasDataFrame(data[safe_columns].copy())
|
|
484
485
|
|
|
485
486
|
if isinstance(data, GeoPandasDataFrame):
|
|
486
487
|
geom_col = data.geometry.name
|
|
@@ -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[float]): 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): Weighting strategy to be used. More details below
|
|
13
|
+
(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,117 @@
|
|
|
1
|
+
Plot sits objects.
|
|
2
|
+
|
|
3
|
+
A single dispatching function that produces a plot appropriate to the type
|
|
4
|
+
of the object passed as `x`. It covers data cubes (raster, SAR, DEM,
|
|
5
|
+
vector), probability and uncertainty products, variance cubes, patterns,
|
|
6
|
+
time-series predictions, embeddings, clustering and SOM outputs, accuracy
|
|
7
|
+
tables, and trained models. Depending on the object type, the plot is
|
|
8
|
+
rendered as a map, a chart, or a raster image.
|
|
9
|
+
|
|
10
|
+
The accepted keyword arguments depend on the type of `x`. The sections
|
|
11
|
+
below group the parameters by the kind of object being plotted.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
x (SITSCubeModel | SITSTimeSeriesModel | SITSTimeSeriesPatternsModel | SITSMachineLearningMethod | SITSConfusionMatrix):
|
|
15
|
+
Object to be plotted. Supported kinds include raster, SAR, DEM,
|
|
16
|
+
and vector cubes; classified, probability, uncertainty, and
|
|
17
|
+
variance cubes; patterns; time-series and embedding predictions;
|
|
18
|
+
geographic distances; clustering and SOM outputs; accuracy
|
|
19
|
+
tables; t-SNE projections; and trained models.
|
|
20
|
+
y: Ignored. Present for compatibility with the generic `plot`.
|
|
21
|
+
band (str): For raster, SAR, DEM, and vector cubes, the band used to
|
|
22
|
+
plot a grey (B/W) image. For SOM maps, the band to be plotted.
|
|
23
|
+
red (str): Band assigned to the red channel for RGB plots of raster,
|
|
24
|
+
SAR, and vector cubes.
|
|
25
|
+
green (str): Band assigned to the green channel for RGB plots.
|
|
26
|
+
blue (str): Band assigned to the blue channel for RGB plots.
|
|
27
|
+
tile (str): Tile to be plotted (for cube objects).
|
|
28
|
+
dates (list[str]): Dates to be plotted (raster, SAR, and vector
|
|
29
|
+
cubes).
|
|
30
|
+
roi (dict): Spatial extent (region of interest) to plot, in WGS 84.
|
|
31
|
+
See notes.
|
|
32
|
+
labels (list[str]): Labels to plot (probability, variance, and vector
|
|
33
|
+
cubes).
|
|
34
|
+
bands (list[str]): Bands to be viewed (for patterns and time-series
|
|
35
|
+
predictions).
|
|
36
|
+
legend (dict): Maps labels to colors (class cubes, SOM maps, and
|
|
37
|
+
cluster confusion plots).
|
|
38
|
+
legend_position (str): Where to place the legend. Typical default is
|
|
39
|
+
`"inside"` for RGB/grey plots and `"outside"` for classified and
|
|
40
|
+
probability maps.
|
|
41
|
+
legend_title (str): Title of the legend for probability and variance
|
|
42
|
+
cubes (for example `"probs"` or `"logvar"`).
|
|
43
|
+
palette (str): An `RColorBrewer` or `cols4all` palette. For
|
|
44
|
+
chart-based plots (predictions, embeddings, clusters, t-SNE), an
|
|
45
|
+
HCL palette name.
|
|
46
|
+
rev (bool): Whether to reverse the color order in the palette.
|
|
47
|
+
scale (float): Relative scale (roughly 0.4 to 1.0) of the plot text
|
|
48
|
+
and map.
|
|
49
|
+
quantile (float): Minimum quantile to plot (probability and variance
|
|
50
|
+
cubes).
|
|
51
|
+
first_quantile (float): First quantile used for stretching images.
|
|
52
|
+
last_quantile (float): Last quantile used for stretching images.
|
|
53
|
+
max_cog_size (int): Maximum size of COG (Cloud Optimized GeoTIFF)
|
|
54
|
+
overviews, in lines/columns (pixels).
|
|
55
|
+
seg_color (str): Color used for segment borders in vector cubes.
|
|
56
|
+
line_width (float): Line width used for segment borders in vector
|
|
57
|
+
cubes.
|
|
58
|
+
type (str): Type of plot. For accuracy objects, either
|
|
59
|
+
`"confusion_matrix"` or `"metrics"`. For variance cubes, `"map"`
|
|
60
|
+
or `"hist"`. For SOM maps, `"codes"` (neuron weight time series)
|
|
61
|
+
or `"mapping"` (number of samples per neuron).
|
|
62
|
+
year_grid (bool): For patterns, whether to plot a grid of panels
|
|
63
|
+
using labels as columns and years as rows (default `False`).
|
|
64
|
+
cluster: For clustering plots, the cluster object produced by
|
|
65
|
+
`sits_cluster_dendro`.
|
|
66
|
+
cutree_height (float): For clustering plots, the height at which to
|
|
67
|
+
draw a dashed horizontal line indicating where the dendrogram is
|
|
68
|
+
cut.
|
|
69
|
+
name_cluster (str): For SOM cluster evaluation, the cluster to plot.
|
|
70
|
+
title (str): For SOM cluster evaluation, the title of the plot.
|
|
71
|
+
tree_idx (int): For XGBoost models, the index of the tree to be
|
|
72
|
+
plotted.
|
|
73
|
+
plot_embedding (str): For embedding predictions, either `"none"` (plot
|
|
74
|
+
only the predicted class intervals) or `"area"` (overlay a
|
|
75
|
+
smoothed vertical embedding profile per year).
|
|
76
|
+
stretch (list[float]): For embedding predictions, the lower and upper
|
|
77
|
+
quantiles used to stretch embedding values before plotting
|
|
78
|
+
(default `[0.02, 0.98]`).
|
|
79
|
+
class_alpha (float): For embedding predictions, transparency of the
|
|
80
|
+
class polygons in `[0, 1]` (default `0.7`).
|
|
81
|
+
area_alpha (float): For embedding predictions, transparency of the
|
|
82
|
+
embedding area in `[0, 1]` (default `0.25`).
|
|
83
|
+
area_width (float): For embedding predictions, the horizontal width
|
|
84
|
+
fraction of the embedding area along the time axis.
|
|
85
|
+
area_spar (float): For embedding predictions, the smoothing parameter
|
|
86
|
+
passed to the spline fit (default `0.6`); higher values produce
|
|
87
|
+
smoother profiles.
|
|
88
|
+
**kwargs (dict): Further specifications for the plot. The keywords
|
|
89
|
+
understood depend on the type of `x` (see below).
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
None: A plot appropriate to the type of `x` is drawn. Maps of cubes
|
|
93
|
+
yield color or B/W raster images (optionally overlaid with segment
|
|
94
|
+
boundaries for vector cubes); probability, uncertainty, and
|
|
95
|
+
variance cubes yield per-class or per-pixel maps; classified cubes
|
|
96
|
+
yield color maps where each pixel is colored by its label.
|
|
97
|
+
Chart-based plots (patterns, predictions, embeddings, clusters,
|
|
98
|
+
t-SNE, model diagnostics) render the corresponding plot. Some
|
|
99
|
+
methods (accuracy tables, SOM diagnostics, model summaries) are
|
|
100
|
+
called only for their side effect of drawing the plot.
|
|
101
|
+
|
|
102
|
+
Notes:
|
|
103
|
+
The set of valid keyword arguments depends on the type of `x`;
|
|
104
|
+
passing arguments that do not apply to a given object type has no
|
|
105
|
+
effect. When a region of interest (`roi`) is supported, it defines
|
|
106
|
+
the spatial extent to plot in WGS 84.
|
|
107
|
+
|
|
108
|
+
Examples:
|
|
109
|
+
from pysits import *
|
|
110
|
+
|
|
111
|
+
# Plot a set of time-series patterns (one average pattern per label)
|
|
112
|
+
patterns = sits_patterns(samples_modis_ndvi)
|
|
113
|
+
plot(patterns)
|
|
114
|
+
|
|
115
|
+
# Train a random forest model and plot its important variables
|
|
116
|
+
rf_model = sits_train(samples_modis_ndvi, ml_method=sits_rfor())
|
|
117
|
+
plot(rf_model)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Assess classification accuracy
|
|
2
|
+
|
|
3
|
+
This function calculates the accuracy of the classification result. The
|
|
4
|
+
input is either a set of classified time series or a classified data cube.
|
|
5
|
+
Classified time series are produced by `sits_classify`. Classified images
|
|
6
|
+
are generated using `sits_classify` followed by
|
|
7
|
+
`sits_label_classification`.
|
|
8
|
+
For a set of time series, `sits_accuracy` creates a confusion matrix and
|
|
9
|
+
calculates the resulting statistics. For a classified image, the function
|
|
10
|
+
uses an area-weighted technique proposed by Olofsson et al. according to
|
|
11
|
+
references [1-3] to produce reliable accuracy estimates at 95% confidence
|
|
12
|
+
level. In both cases, it provides an accuracy assessment of the
|
|
13
|
+
classified, including Overall Accuracy, Kappa, User's Accuracy, Producer's
|
|
14
|
+
Accuracy and error matrix (confusion matrix).
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
data (SITSCubeModel | SITSTimeSeriesModel): Either a data cube with
|
|
18
|
+
classified images or a set of time series.
|
|
19
|
+
prediction_attr (str): Name of the column of the segments that contains
|
|
20
|
+
the predicted values (only for vector class cubes).
|
|
21
|
+
reference_attr (str): Name of the column of the segments that contains
|
|
22
|
+
the reference values (only for vector class cubes).
|
|
23
|
+
validation (str | pathlib.Path | pandas.DataFrame | geopandas.GeoDataFrame | SITSTimeSeriesModel):
|
|
24
|
+
Samples for validation (see below). Only required when data is a
|
|
25
|
+
raster class cube.
|
|
26
|
+
method (str): Either 'olofsson' or 'pixel' to compute accuracy (only
|
|
27
|
+
for raster class cubes).
|
|
28
|
+
**kwargs (dict): Specific parameters.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
SITSData: The error_matrix, the class_areas, the unbiased estimated
|
|
32
|
+
areas, the standard error areas, confidence interval 95 and the
|
|
33
|
+
accuracy (user, producer, and overall), or `None` if the data is
|
|
34
|
+
empty. The result can be visualized directly on the screen.
|
|
35
|
+
|
|
36
|
+
Notes:
|
|
37
|
+
The `validation` data needs to contain the following columns:
|
|
38
|
+
"latitude", "longitude", "start_date", "end_date", and "label". It can
|
|
39
|
+
be either a path to a CSV file, a `SITSTimeSeriesModel`, a
|
|
40
|
+
`pandas.DataFrame`, or a `geopandas.GeoDataFrame`.
|
|
41
|
+
When `validation` is a `geopandas.GeoDataFrame`, the columns "latitude"
|
|
42
|
+
and "longitude" are not required as the locations are extracted from the
|
|
43
|
+
geometry column. The `centroid` is calculated before extracting the
|
|
44
|
+
location values for any geometry type.
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
from pysits import *
|
|
48
|
+
import tempfile
|
|
49
|
+
|
|
50
|
+
# show accuracy for a set of samples
|
|
51
|
+
train_data = sits_sample(samples_modis_ndvi, frac=0.5)
|
|
52
|
+
test_data = sits_sample(samples_modis_ndvi, frac=0.5)
|
|
53
|
+
rfor_model = sits_train(train_data, sits_rfor())
|
|
54
|
+
points_class = sits_classify(
|
|
55
|
+
data=test_data, ml_model=rfor_model
|
|
56
|
+
)
|
|
57
|
+
acc = sits_accuracy(points_class)
|
|
58
|
+
|
|
59
|
+
# show accuracy for a data cube classification
|
|
60
|
+
# create a random forest model
|
|
61
|
+
rfor_model = sits_train(samples_modis_ndvi, sits_rfor())
|
|
62
|
+
# create a data cube from local files
|
|
63
|
+
data_dir = r_package_dir("extdata/raster/mod13q1", package="sits")
|
|
64
|
+
cube = sits_cube(
|
|
65
|
+
source="BDC",
|
|
66
|
+
collection="MOD13Q1-6.1",
|
|
67
|
+
data_dir=data_dir
|
|
68
|
+
)
|
|
69
|
+
# classify a data cube
|
|
70
|
+
probs_cube = sits_classify(
|
|
71
|
+
data=cube, ml_model=rfor_model, output_dir=tempfile.gettempdir()
|
|
72
|
+
)
|
|
73
|
+
# label the probability cube
|
|
74
|
+
label_cube = sits_label_classification(
|
|
75
|
+
probs_cube,
|
|
76
|
+
output_dir=tempfile.gettempdir()
|
|
77
|
+
)
|
|
78
|
+
# obtain the ground truth for accuracy assessment
|
|
79
|
+
ground_truth = r_package_dir("extdata/samples/samples_sinop_crop.csv", package="sits")
|
|
80
|
+
# make accuracy assessment
|
|
81
|
+
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
|
|
4
|
+
common usage in Earth Observation.
|
|
5
|
+
|
|
6
|
+
Args:
|
|
7
|
+
x (SITSConfusionMatrix): Accuracy assessment object.
|
|
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): Base data cube (e.g., DEM).
|
|
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,102 @@
|
|
|
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, it
|
|
5
|
+
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 produces 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: A set of time series or a data cube with new bands, produced
|
|
22
|
+
according 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 expression to compute new bands. Besides
|
|
43
|
+
arithmetic operators, you can use virtually any function that can be
|
|
44
|
+
applied to elements of a matrix (functions that are unaware of matrix
|
|
45
|
+
sizes, e.g. `sqrt()`, `sin()`, `log()`).
|
|
46
|
+
Examples of valid expressions:
|
|
47
|
+
1. `NDVI = (B08 - B04) / (B08 + B04)` for Sentinel-2 images.
|
|
48
|
+
2. `EVI = 2.5 * (B05 ook04) / (B05 + 6 * B04 7.5 * B02 + 1)` for
|
|
49
|
+
Landsat-8/9 images.
|
|
50
|
+
3. `VV_VH_RATIO = VH/VV` for Sentinel-1 images. In this case, set the
|
|
51
|
+
`normalized` parameter to False.
|
|
52
|
+
4. `VV_DB = 10 * log10(VV)` to convert Sentinel-1 RTC images available in
|
|
53
|
+
Planetary Computer to decibels. Also, set the `normalized` parameter to
|
|
54
|
+
False.
|
|
55
|
+
`sits_apply()` also accepts a predefined set of kernel functions (see
|
|
56
|
+
below) that can be applied to pixels considering its neighborhood. The
|
|
57
|
+
function considers a neighborhood of a pixel as a set of pixels equidistant
|
|
58
|
+
to it (including itself). This neighborhood forms a square window (also
|
|
59
|
+
known as kernel) around the central pixel (Moore neighborhood). Users can
|
|
60
|
+
set the `window_size` parameter to adjust the size of the kernel window.
|
|
61
|
+
The image is conceptually mirrored at the edges so that neighborhood
|
|
62
|
+
including a pixel outside the image is equivalent to take the 'mirrored'
|
|
63
|
+
pixel inside the edge.
|
|
64
|
+
`sits_apply()` applies a function to the kernel and its result is assigned
|
|
65
|
+
to a corresponding central pixel on a new matrix. The kernel slides
|
|
66
|
+
throughout the input image and this process generates an entire new matrix,
|
|
67
|
+
which is returned as a new band to the cube. The kernel functions ignores
|
|
68
|
+
any `None` values inside the kernel window. If all pixels in the window are
|
|
69
|
+
`None` the result will be `None`.
|
|
70
|
+
By default, the indexes generated by `sits_apply()` function are normalized
|
|
71
|
+
between -1 and 1, scaled by a factor of 0.0001. Normalized indexes are
|
|
72
|
+
saved as INT2S (Integer with sign). If the `normalized` parameter is False,
|
|
73
|
+
no scaling factor will be applied and the index will be saved as FLT4S
|
|
74
|
+
(signed float) and the values will vary between -3.4e+38 and 3.4e+38.
|
|
75
|
+
|
|
76
|
+
Examples:
|
|
77
|
+
from pysits import *
|
|
78
|
+
import tempfile
|
|
79
|
+
|
|
80
|
+
# get a time series
|
|
81
|
+
# Apply a normalization function
|
|
82
|
+
point2 = sits_apply(
|
|
83
|
+
sits_select(point_mt_6bands, "NDVI"),
|
|
84
|
+
NDVI_norm="(NDVI - min(NDVI)) / (max(NDVI) - min(NDVI))"
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
# Example of generation texture band with variance
|
|
88
|
+
# Create a data cube from local files
|
|
89
|
+
data_dir = r_package_dir("extdata/raster/mod13q1", package="sits")
|
|
90
|
+
cube = sits_cube(
|
|
91
|
+
source="BDC",
|
|
92
|
+
collection="MOD13Q1-6.1",
|
|
93
|
+
data_dir=data_dir
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Generate a texture images with variance in NDVI images
|
|
97
|
+
cube_texture = sits_apply(
|
|
98
|
+
data=cube,
|
|
99
|
+
NDVITEXTURE="w_median(NDVI)",
|
|
100
|
+
window_size=5,
|
|
101
|
+
output_dir=tempfile.mkdtemp()
|
|
102
|
+
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Return a set of time series or a data cube as a `geopandas.GeoDataFrame`.
|
|
2
|
+
|
|
3
|
+
Converts a set of time series or a data cube to a `geopandas.GeoDataFrame`.
|
|
4
|
+
|
|
5
|
+
Args:
|
|
6
|
+
data (SITSTimeSeriesModel | SITSCubeModel): a set of time series or
|
|
7
|
+
a data cube.
|
|
8
|
+
crs (CRS): input coordinate reference system.
|
|
9
|
+
as_crs (CRS): output coordinate reference system.
|
|
10
|
+
**kwargs (dict): additional parameters.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
SITSFrame: a point or polygon geometry object.
|
|
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)
|