-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from nasaharvest/importable-datasets
Importable datasets
- Loading branch information
Showing
19 changed files
with
230 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[flake8] | ||
exclude = venv,build,dist | ||
exclude = venv,build,dist,openmapflow/datasets.py | ||
max-line-length = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: 0.1.0 | ||
version: 0.1.1 | ||
project: buildings-example | ||
description: OpenMapFlow buildings example | ||
gcloud: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,9 @@ | ||
from typing import List | ||
|
||
from openmapflow.datasets import geowiki_landcover_2017, togo_crop_2019 | ||
from openmapflow.labeled_dataset import LabeledDataset, create_datasets | ||
from openmapflow.raw_labels import RawLabels | ||
|
||
datasets: List[LabeledDataset] = [ | ||
LabeledDataset( | ||
dataset="geowiki_landcover_2017", | ||
country="global", | ||
raw_labels=( | ||
RawLabels( | ||
filename="loc_all_2.txt", | ||
longitude_col="loc_cent_X", | ||
latitude_col="loc_cent_Y", | ||
class_prob=lambda df: df.sumcrop / 100, | ||
start_year=2017, | ||
x_y_from_centroid=False, | ||
), | ||
), | ||
), | ||
LabeledDataset( | ||
dataset="Togo_2019", | ||
country="Togo", | ||
raw_labels=( | ||
RawLabels( | ||
filename="crop_merged_v2.zip", | ||
class_prob=1.0, | ||
train_val_test=(0.8, 0.2, 0.0), | ||
start_year=2019, | ||
), | ||
RawLabels( | ||
filename="noncrop_merged_v2.zip", | ||
class_prob=0.0, | ||
train_val_test=(0.8, 0.2, 0.0), | ||
start_year=2019, | ||
), | ||
RawLabels( | ||
filename="random_sample_hrk.zip", | ||
class_prob=lambda df: df["hrk-label"], | ||
transform_crs_from=32631, | ||
train_val_test=(0.0, 0.0, 1.0), | ||
start_year=2019, | ||
), | ||
RawLabels( | ||
filename="random_sample_cn.zip", | ||
class_prob=lambda df: df["cn_labels"], | ||
train_val_test=(0.0, 0.0, 1.0), | ||
start_year=2019, | ||
), | ||
RawLabels( | ||
filename="BB_random_sample_1k.zip", | ||
class_prob=lambda df: df["bb_label"], | ||
train_val_test=(0.0, 0.0, 1.0), | ||
start_year=2019, | ||
), | ||
RawLabels( | ||
filename="random_sample_bm.zip", | ||
class_prob=lambda df: df["bm_labels"], | ||
train_val_test=(0.0, 0.0, 1.0), | ||
start_year=2019, | ||
), | ||
), | ||
), | ||
] | ||
datasets: List[LabeledDataset] = [geowiki_landcover_2017, togo_crop_2019] | ||
|
||
if __name__ == "__main__": | ||
create_datasets(datasets) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: 0.1.0 | ||
version: 0.1.1 | ||
project: crop-mask-example | ||
description: OpenMapFlow crop mask example | ||
gcloud: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: 0.1.0 | ||
version: 0.1.1 | ||
project: maize-example | ||
description: OpenMapFlow maize example | ||
gcloud: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from openmapflow.labeled_dataset import ExistingLabeledDataset | ||
|
||
geowiki_landcover_2017 = ExistingLabeledDataset( | ||
dataset="geowiki_landcover_2017", | ||
source=( | ||
"Linda See. A global reference database of crowdsourced cropland data collected using the " | ||
+ "Geo-Wiki platform, 2017." | ||
), | ||
label_type="binary", | ||
license="CC BY-3.0", | ||
country="global", | ||
download_url="https://storage.googleapis.com/harvest-public-assets/openmapflow/datasets/crop/geowiki_landcover_2017.csv", | ||
) | ||
|
||
togo_crop_2019 = ExistingLabeledDataset( | ||
country="Togo", | ||
dataset="Togo_2019", | ||
download_url="https://storage.googleapis.com/harvest-public-assets/openmapflow/datasets/crop/Togo_2019.csv", | ||
label_type="binary", | ||
license="CC BY-4.0", | ||
source=( | ||
"Hannah Kerner, Gabriel Tseng, Inbal Becker-Reshef, Catherine Nakalembe, " | ||
+ " Brian Barker, Blake Munshell, Madhava Paliyam, and Mehdi Hosseini. Rapid response " | ||
+ "crop maps in data sparse regions. In ACM SIGKDD Conference on Data Mining and " | ||
+ "Knowledge Discovery Workshops, 2020." | ||
), | ||
) |
Oops, something went wrong.