Skip to content

Commit

Permalink
Merge pull request #806 from alan-turing-institute/export_dataset
Browse files Browse the repository at this point in the history
adding some features
  • Loading branch information
edasu authored Sep 7, 2022
2 parents c54ba37 + 6d0f50a commit f9df6d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
def download(
download_root: Path,
verbose: bool = False,
training_data: bool = typer.Option(
False,
"--training-data",
help="Download training data",
),
) -> None:
"""Setup load data"""
secretfile: str = state["secretfile"]
Expand All @@ -50,16 +45,22 @@ def download(
pred_sources=[Source.laqn],
pred_interest_points={Source.laqn: "all"},
species=[Species.NO2],
static_features=[StaticFeatureNames.park],
norm_by=Source.laqn,
static_features=[
StaticFeatureNames.park,
StaticFeatureNames.flat,
StaticFeatureNames.total_road_length,
StaticFeatureNames.max_canyon_ratio,
StaticFeatureNames.building_height,
],
buffer_sizes=[FeatureBufferSize.two_hundred],
dynamic_features=[],
)

model_config = ModelConfig(secretfile=secretfile)
model_data = ModelData(secretfile=secretfile)
full_config = model_config.generate_full_config(data_config)

training_data: Dict[Source, pd.DateFrame] = model_data.download_config_data( # noqa
full_config, training_data=True
)

training_data[Source.laqn].to_csv(download_root / "training_data.csv")
13 changes: 9 additions & 4 deletions docs/exportdata.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Export Data

You can find the datasets from here [Datasets](datasets.md)
Find here existed [datasets](datasets.md)

*Command used for downloading the dataset*
## Create a secrets file

- This command saves LAQN data as a CSV file to the specified path.
Create a JSON secret file that will connect to azure database.
[Follow this guide to creating a secret file for a azure database](secretfile.md#azure-database).

## Export laqn data

This command saves four days of LAQN data as a CSV file to the specified path.

```
urbanair dataset download ~Dataset/urbanair
urbanair dataset download ~/Datasets/urbanair
```
3 changes: 1 addition & 2 deletions docs/secretfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ echo '{
"ssl_mode": "prefer"
}' >> $DB_SECRET_FILE
```

<<<<<<< HEAD

***
Expand All @@ -121,5 +122,3 @@ docker run -v "${SECRET_DIR}":/secrets ... --secretfile /secrets/.db_secrets_doc
```

If you don't use the `--secretfile` option for running the command, you *might* also need to add an environment variable that tells the *docker container* about the name of the secrets file by adding `-e DB_SECRET_FILE=".db_secrets_docker.json"`.
=======
>>>>>>> master

0 comments on commit f9df6d4

Please sign in to comment.