timesat-cli 0.0.0__py3-none-any.whl
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.
Potentially problematic release.
This version of timesat-cli might be problematic. Click here for more details.
- timesat_cli/__init__.py +18 -0
- timesat_cli/__main__.py +12 -0
- timesat_cli/config.py +160 -0
- timesat_cli/csvutils.py +93 -0
- timesat_cli/fsutils.py +25 -0
- timesat_cli/parallel.py +32 -0
- timesat_cli/processing.py +169 -0
- timesat_cli/qa.py +25 -0
- timesat_cli/readers.py +154 -0
- timesat_cli/writers.py +35 -0
- timesat_cli-0.0.0.dist-info/METADATA +212 -0
- timesat_cli-0.0.0.dist-info/RECORD +15 -0
- timesat_cli-0.0.0.dist-info/WHEEL +4 -0
- timesat_cli-0.0.0.dist-info/entry_points.txt +3 -0
- timesat_cli-0.0.0.dist-info/licenses/LICENSE +674 -0
timesat_cli/writers.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import List, Tuple
|
|
3
|
+
import rasterio
|
|
4
|
+
from rasterio.windows import Window
|
|
5
|
+
|
|
6
|
+
__all__ = ["prepare_profiles", "write_vpp_layers", "write_st_layers"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def prepare_profiles(img_profile, p_nodata: float, scale: float, offset: float):
|
|
10
|
+
import copy
|
|
11
|
+
img_profile_st = copy.deepcopy(img_profile)
|
|
12
|
+
img_profile_st.update(compress='lzw')
|
|
13
|
+
if scale != 0 or offset != 0:
|
|
14
|
+
img_profile_st.update(dtype=rasterio.float32)
|
|
15
|
+
|
|
16
|
+
img_profile_vpp = copy.deepcopy(img_profile)
|
|
17
|
+
img_profile_vpp.update(nodata=p_nodata, dtype=rasterio.float32, compress='lzw')
|
|
18
|
+
|
|
19
|
+
img_profile_ns = copy.deepcopy(img_profile)
|
|
20
|
+
img_profile_ns.update(nodata=255, compress='lzw')
|
|
21
|
+
return img_profile_st, img_profile_vpp, img_profile_ns
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def write_vpp_layers(paths: List[str], arrays, window: Tuple[int, int, int, int], img_profile_vpp):
|
|
25
|
+
x_map, y_map, x, y = window
|
|
26
|
+
for i, arr in enumerate(arrays, 1):
|
|
27
|
+
with rasterio.open(paths[i - 1], 'r+', **img_profile_vpp) as outvppfile:
|
|
28
|
+
outvppfile.write(arr, window=Window(x_map, y_map, x, y), indexes=1)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def write_st_layers(paths: List[str], arrays, window: Tuple[int, int, int, int], img_profile_st):
|
|
32
|
+
x_map, y_map, x, y = window
|
|
33
|
+
for i, arr in enumerate(arrays, 1):
|
|
34
|
+
with rasterio.open(paths[i - 1], 'r+', **img_profile_st) as outstfile:
|
|
35
|
+
outstfile.write(arr, window=Window(x_map, y_map, x, y), indexes=1)
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: timesat-cli
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Python-based command line interface for TIMESAT
|
|
5
|
+
Author: Zhanzhang Cai
|
|
6
|
+
License: GPL-3.0-only
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: pandas
|
|
18
|
+
Requires-Dist: rasterio
|
|
19
|
+
Requires-Dist: timesat
|
|
20
|
+
Provides-Extra: parallel
|
|
21
|
+
Requires-Dist: ray; extra == 'parallel'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# TIMESAT CLI
|
|
25
|
+
|
|
26
|
+
`TIMESAT CLI` is a command line interface and workflow manager for the [TIMESAT](https://pypi.org/project/timesat/) package.
|
|
27
|
+
It provides a convenient way to configure and execute TIMESAT processing pipelines directly from the command line or automated scripts.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Requirements
|
|
32
|
+
|
|
33
|
+
Before you begin, make sure you have:
|
|
34
|
+
|
|
35
|
+
- **Miniconda** or **Anaconda** (for environment management)
|
|
36
|
+
Download: [https://docs.conda.io/en/latest/miniconda.html](https://docs.conda.io/en/latest/miniconda.html)
|
|
37
|
+
- **Python 3.10+**
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
`timesat-cli` is available on **PyPI** and can be installed using **pip** or **uv**.
|
|
44
|
+
Although it is not published on Conda, you can safely install it *inside* a Conda environment.
|
|
45
|
+
|
|
46
|
+
### Option 1 — Install inside a Conda environment
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
conda create -n timesat-cli python=3.12
|
|
50
|
+
conda activate timesat-cli
|
|
51
|
+
pip install timesat-cli
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> This approach uses Conda only for environment isolation.
|
|
55
|
+
> The installation itself is handled by pip, which will automatically install `timesat` and all required dependencies.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### Option 2 — Install via uv (recommended for pure Python environments)
|
|
60
|
+
|
|
61
|
+
[`uv`](https://github.com/astral-sh/uv) is a modern, high-performance alternative to pip and venv.
|
|
62
|
+
|
|
63
|
+
1. Install `uv`:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install uv
|
|
67
|
+
# or
|
|
68
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
2. Create a virtual environment and install the package:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uv venv .venv
|
|
75
|
+
source .venv/bin/activate
|
|
76
|
+
uv pip install timesat-cli
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
> `uv` provides faster dependency resolution and caching.
|
|
80
|
+
> It will automatically install `timesat` and related dependencies.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### Option 3 — Direct installation with pip
|
|
85
|
+
|
|
86
|
+
If you already have Python 3.10+ installed:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install timesat-cli
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## ⚙️ Optional: Parallel Processing Support
|
|
95
|
+
|
|
96
|
+
`timesat-cli` provides an optional extra for **parallel execution** using [`ray`](https://www.ray.io/).
|
|
97
|
+
|
|
98
|
+
To install with parallel-processing support:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pip install timesat-cli[parallel]
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This installs the base package plus the ray dependency.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Running the Application
|
|
109
|
+
|
|
110
|
+
After installation, start the GUI with:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
timesat-cli path/to/settings.json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
or equivalently:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python -m timesat_cli path/to/settings.json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Advanced Usage
|
|
125
|
+
|
|
126
|
+
If you wish to customize or extend the workflow, you can also run or modify the main script directly:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
python timesat_run.py
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The file 'timesat_run.py' contains the full example pipeline that invokes core modules from the 'timesat_cli' package, including configuration loading, file management, TIMESAT processing, and output writing.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## HRVPP Notes — QFLAG2 weights
|
|
137
|
+
If you work with HRVPP quality flags (`QFLAG2`), the following weights `w` are commonly applied:
|
|
138
|
+
|
|
139
|
+
| QFLAG2 value | Weight `w` |
|
|
140
|
+
|---:|---:|
|
|
141
|
+
| 1 | 1.0 |
|
|
142
|
+
| 4097 | 1.0 |
|
|
143
|
+
| 8193 | 1.0 |
|
|
144
|
+
| 12289 | 1.0 |
|
|
145
|
+
| 1025 | 0.5 |
|
|
146
|
+
| 9217 | 0.5 |
|
|
147
|
+
| 2049 | 0.5 |
|
|
148
|
+
| 6145 | 0.5 |
|
|
149
|
+
| 3073 | 0.5 |
|
|
150
|
+
|
|
151
|
+
Example (settings.json):
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
"p_a": {
|
|
155
|
+
"value": [
|
|
156
|
+
[1, 1.0],
|
|
157
|
+
[4097, 1.0],
|
|
158
|
+
[8193, 1.0],
|
|
159
|
+
[12289, 1.0],
|
|
160
|
+
[1025, 0.5],
|
|
161
|
+
[9217, 0.5],
|
|
162
|
+
[2049, 0.5],
|
|
163
|
+
[6145, 0.5],
|
|
164
|
+
[3073, 0.5]
|
|
165
|
+
],
|
|
166
|
+
"description": "QA weighting rules. Leave empty [] to keep original QA values. Use [qa_value, weight] for exact matches or [min, max, weight] for ranges."
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
**TIMESAT-CLI** is released under the **GNU General Public License (GPL)**.
|
|
175
|
+
You are free to use, modify, and distribute this software under the terms of the GPL.
|
|
176
|
+
|
|
177
|
+
The GPL license applies **only to the TIMESAT-CLI source code and assets** provided in this repository.
|
|
178
|
+
|
|
179
|
+
### 📦 Dependency Licenses
|
|
180
|
+
|
|
181
|
+
- `timesat` may install additional open-source dependencies (e.g., Flask, pandas, NumPy).
|
|
182
|
+
- Each dependency retains its own license (MIT, BSD, Apache, etc.).
|
|
183
|
+
- Before redistributing or bundling this software, review the license terms of each dependency carefully.
|
|
184
|
+
|
|
185
|
+
### ⚖️ Summary
|
|
186
|
+
|
|
187
|
+
| Component | License Type | Notes |
|
|
188
|
+
|------------------|--------------|-------|
|
|
189
|
+
| TIMESAT-CLI | GPL v3 | Open source, modification and redistribution permitted under GPL. |
|
|
190
|
+
| TIMESAT | Proprietary | All rights reserved. Redistribution and modification prohibited without written consent. |
|
|
191
|
+
| Other Dependencies | Various (MIT/BSD/Apache) | Check individual package licenses before redistribution. |
|
|
192
|
+
|
|
193
|
+
For detailed license information, refer to the license files distributed with each installed package.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Citation
|
|
198
|
+
|
|
199
|
+
If you use **TIMESAT**, **TIMESAT-CLI** or **TIMESAT-GUI** in your research, please cite the corresponding release on Zenodo:
|
|
200
|
+
|
|
201
|
+
> Cai, Z., Eklundh, L., & Jönsson, P. (2025). *TIMESAT4: is a software package for analysing time-series of satellite sensor data* (Version 4.1.x) [Computer software]. Zenodo.
|
|
202
|
+
> [https://doi.org/10.5281/zenodo.17369757](https://doi.org/10.5281/zenodo.17369757)
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Acknowledgments
|
|
207
|
+
|
|
208
|
+
- [TIMESAT](https://www.nateko.lu.se/TIMESAT) — Original analysis framework for satellite time-series data.
|
|
209
|
+
- This project acknowledges the Swedish National Space Agency (SNSA), the European Environment Agency (EEA), and the European Space Agency (ESA) for their support and for providing access to satellite data and related resources that made this software possible.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
timesat_cli/__init__.py,sha256=P1Vnot2l024uaeErIc7pMDWOCkBjI4NuYjPsW77HYN4,358
|
|
2
|
+
timesat_cli/__main__.py,sha256=UCWmnb2ksBxOVxqjHKfViMBEEqUsSOAlGyPDEp8mX3A,356
|
|
3
|
+
timesat_cli/config.py,sha256=VzlivmYqyzeQEzkH8nhJSSYG55DAnF43W3QQSv9RszY,4772
|
|
4
|
+
timesat_cli/csvutils.py,sha256=M5Y9E_ropVwF3oFqVGboGZEC8sJ62AmPnskxAYBgJiI,3431
|
|
5
|
+
timesat_cli/fsutils.py,sha256=yCI39sKyEZ0ucHU_4Mje3LoXQe_0J5REZqJXUu0HF9w,893
|
|
6
|
+
timesat_cli/parallel.py,sha256=ZoQ9nHDcc3dUgjvYKEyFeAjRGn-3-z5XD2SfRx9mmbA,816
|
|
7
|
+
timesat_cli/processing.py,sha256=iJzgigRN93BMBSNvc0VyXD6vK8XWAeGAFTvVvdMWLAs,7463
|
|
8
|
+
timesat_cli/qa.py,sha256=kd4Z7t50YnSfRXaFcMdSlHFx3VobPKOdz0Y5wVclFYg,705
|
|
9
|
+
timesat_cli/readers.py,sha256=NMapVHthV3BJhoYZr0jrXJ8ZOyGn36qRljftFnim9Pw,5393
|
|
10
|
+
timesat_cli/writers.py,sha256=zsiugWhh6EojRnqP5bO6NoxCTuIiDnGiXHLsn6zS2Lg,1427
|
|
11
|
+
timesat_cli-0.0.0.dist-info/METADATA,sha256=u7MpyOScKJujOTxRt_JZMY_xyiX0t7sHo0Vyehso0ZI,6081
|
|
12
|
+
timesat_cli-0.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
+
timesat_cli-0.0.0.dist-info/entry_points.txt,sha256=yvKIc4riurmeZCWKF04KUlD4hJu4iEePjbulDQAm7-Y,94
|
|
14
|
+
timesat_cli-0.0.0.dist-info/licenses/LICENSE,sha256=YF6QR6Vjxcg5b_sYIyqkME7FZYau5TfEUGTG-0JeRK0,35129
|
|
15
|
+
timesat_cli-0.0.0.dist-info/RECORD,,
|