Skip to content

Commit 1e2edc3

Browse files
authored
Merge pull request #2 from carderne/main
Small README and config improvements
2 parents 35b2b88 + a3f300e commit 1e2edc3

File tree

5 files changed

+88
-28
lines changed

5 files changed

+88
-28
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Custom
2+
output/*
3+
14
*.py[cod]
25
__pycache__
36

README.md

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,38 +164,89 @@ In order to run **SatExtractor** we recommend to have a virtual env and a cloud
164164
🔴🔴🔴
165165
```diff
166166
- WARNING!!!!:
167-
Running SatExtractor will use your billable cloud provider services.
168-
We strongly recommend testing it with a small region to see if everything is working ok.
167+
Running SatExtractor will use your billable cloud provider services.
168+
We strongly recommend testing it with a small region to see if everything is working ok.
169169
Be sure you are running all your cloud provider services in the same region to avoid extra costs.
170170
```
171171
🔴🔴🔴
172172

173-
Once a cloud provider user is set and the package is installed you'll need to grab the geojson region you want (you can get it from the super-cool tool [geojson.io](geojson.io)) and change the config files.
173+
Once a cloud provider user is set and the package is installed you'll need to grab the GeoJSON region you want (you can get it from the super-cool tool [geojson.io](http://geojson.io/)) and change the config files.
174174

175175

176-
1. Save the region as `<your_region_name>.geojson` and store it in the `outputs` folder (you can change your output dir in the `config.yaml`)
177-
2. Open the `config.yaml` and you'll see something like this:
178-
179-
<img src="images/config.png" alt="Logo">
176+
1. Choose a region name (eg `cordoba` below) and create an output directory for it:
177+
```
178+
mkdir output/cordoba
179+
```
180+
2. Save the region GeoJSON as `aoi.geojson` and store it in the folder you just created.
181+
3. Open the `config.yaml` and you'll see something like this:
182+
183+
```yaml
184+
dataset_name: cordoba
185+
output: ./output/${dataset_name}
186+
187+
log_path: ${output}/main.log
188+
credentials: ${output}/token.json
189+
gpd_input: ${output}/aoi.geojson
190+
item_collection: ${output}/item_collection.geojson
191+
tiles: ${output}/tiles.pkl
192+
extraction_tasks: ${output}/extraction_tasks.pkl
193+
194+
start_date: 2020-01-01
195+
end_date: 2020-02-01
196+
197+
constellations:
198+
- sentinel-2
199+
- landsat-5
200+
- landsat-7
201+
- landsat-8
202+
203+
defaults:
204+
- stac: gcp
205+
- tiler: utm
206+
- scheduler: utm
207+
- deployer: gcp
208+
- builder: gcp
209+
- cloud: gcp
210+
- preparer: gcp
211+
- _self_
212+
tasks:
213+
- build
214+
- stac
215+
- tile
216+
- schedule
217+
- prepare
218+
- deploy
219+
220+
hydra:
221+
run:
222+
dir: .
223+
```
180224
181225
The important here is to set the `dataset_name` to `<your_region_name>`, define the `start_date` and `end_date` for your revisits, your `constellations` and the tasks to be run (you would want to run the `build` only one time and the comment it out.)
182226

183-
**Important**: the `token.json` contains the needed credentials to access you cloud provider. In this example case it contains the gcp credentials. You'll need to provide it.
227+
**Important**: the `token.json` contains the needed credentials to access you cloud provider. In this example case it contains the gcp credentials. You can see instructions for getting it below in the [Authentication](#authentication) instructions.
184228

185229
3. Open the `cloud/<provider>.yaml` and add there your account info as in the default provided file.
186230
(optional): you can choose different configurations by changing modules configs: `builder`, `stac`, `tiler`, `scheduler`, `preparer`, etc. There you can change things like patch_size, chunk_size.
187231

188232
4. Run `python src/satextractor/cli.py` and enjoy!
189233

190-
191-
<p align="right">(<a href="#top">back to top</a>)</p>
192-
193-
194234
See the [open issues](https://github.com/FrontierDevelopmentLab/sat-extractor/issues) for a full list of proposed features (and known issues).
195235

196236
<p align="right">(<a href="#top">back to top</a>)</p>
197237

198238

239+
## Authentication
240+
### Google Cloud
241+
To get the `token.json` for Google Cloud, the recommended approach is to create a service account:
242+
1. Go to [Credentials](https://console.cloud.google.com/apis/credentials)
243+
2. Click `Create Credentials` and choose `Service account`
244+
3. Enter a name (e.g. `sat-extractor`) and click `Done` (you may also want to modify permissions and users)
245+
4. Choose the account from the list and then to to the `Keys` tab
246+
5. Click `Add key` -> `Create new key` -> `JSON` and save the file that gets downloaded
247+
6. Rename to `token.json` and you're done!
248+
249+
You may also need to run `gcloud config set project your-proj-name` for `sat-extractor` to work properly.
199250

200251
<!-- CONTRIBUTING -->
201252
## Contributing
@@ -231,4 +282,4 @@ Distributed under the BSD 2 License. See `LICENSE.txt` for more information.
231282
</div>
232283

233284

234-
This work is the result of the 2021 ESA Frontier Development Lab World Food Embeddings team. We are grateful to all organisers, mentors and sponsors for providing us this opportunity. We thank Google Cloud for providing computing and storage resources to complete this work.
285+
This work is the result of the 2021 ESA Frontier Development Lab World Food Embeddings team. We are grateful to all organisers, mentors and sponsors for providing us this opportunity. We thank Google Cloud for providing computing and storage resources to complete this work.

conf/config.yaml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
dataset_name: cordoba
2+
output: ./output/${dataset_name}
3+
4+
log_path: ${output}/main.log
5+
credentials: ${output}/token.json
6+
gpd_input: ${output}/aoi.geojson
7+
item_collection: ${output}/item_collection.geojson
8+
tiles: ${output}/tiles.pkl
9+
extraction_tasks: ${output}/extraction_tasks.pkl
10+
11+
start_date: 2020-01-01
12+
end_date: 2020-02-01
13+
14+
constellations:
15+
- sentinel-2
16+
- landsat-5
17+
- landsat-7
18+
- landsat-8
19+
120
defaults:
221
- stac: gcp
322
- tiler: utm
@@ -14,21 +33,7 @@ tasks:
1433
- schedule
1534
- prepare
1635
- deploy
17-
dataset_name: cordoba
18-
output: ./outputs/${dataset_name}
36+
1937
hydra:
2038
run:
2139
dir: .
22-
log_path: ${output}/main.log
23-
credentials: ${output}/token.json
24-
gpd_input: ${output}/${dataset_name}.geojson
25-
item_collection: ${output}/item_collection.geojson
26-
tiles: ${output}/tiles.pkl
27-
extraction_tasks: ${output}/extraction_tasks.pkl
28-
start_date: 2020-01-01
29-
end_date: 2020-02-01
30-
constellations:
31-
- sentinel-2
32-
- landsat-5
33-
- landsat-7
34-
- landsat-8

images/config.png

-80.1 KB
Binary file not shown.

output/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Output directories (e.g. `cordoba`) go here.

0 commit comments

Comments
 (0)