Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update quickstarter with dagworks platform instructions #162

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 46 additions & 7 deletions docs/source/quickstarter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ Quickstarter
============


Data input
Input data
----------

The only input data required for `naturf` is a shapefile with building footprints and height data. There should be a field with a unique ID for each building the shapefile, and it should be in a projected coordinate system such as Alber Equal Area Conic. For input to the Weather Research and Forecasting model (WRF), the computed parameters for each building will be projected into WGS 84.

Either check out our interactive `quickstarter <quickstarter.rst>`_, or continue below to run `naturf` using a python file.

Install `naturf`
-----------------
1. Install `naturf`
-------------------

In a clean virtual or Conda environment, install `naturf`. NOTE: For Conda environments using Python 3.12, the `setuptools` package does not work as intended. One workaround is to create a Conda environment in Python 3.11.

.. code:: bash

pip install naturf

Edit config variables and create run script
-------------------------------------------
2. Edit config variables and create run script
----------------------------------------------

The `config` module in `naturf` sets the default names for variables used in the `naturf` workflow. The two variables below need to be modified to reflect the ID field and the building height field of the input shapefile. Instructions on changing field names will be given further below.

Expand Down Expand Up @@ -62,10 +62,49 @@ To run data other than the example data, create the `run.py` below.
df = model.execute()
model.graph()

Run `naturf`
------------
3. Run `naturf`
---------------
This will run all functions required to create the output specified in the `run.py` `output_columns` variable. Currently `write_binary` and `write_index`. The `path` variable should point towards the input shapefile.

.. code:: bash

python run.py


Run using the `DAGWorks Platform <app.dagworks.io>`_
----------------------------------------------------

Import os and the DAGWorks Tracker:

.. code:: python3

import os
from dagworks import adapters

Add this to `run.py` at the top of main:

.. code:: python3

tracker = adapters.DAGWorksTracker(
project_id=<your project ID>,
api_key=os.environ["DAGWORKS_API_KEY"],
username="<your username>",
dag_name="<name of the DAG>",
tags={"environment": "DEV", "team": "MY_TEAM", "version": "X"}
)

Set the API Key as an environment variable:

.. code:: bash

$ export DAGWORKS_API_KEY="<your API Key>"

Add `tracker` in the `hamilton_adaptors` list:

.. code:: python3

hamilton_adapters = [
base.SimplePythonDataFrameGraphAdapter(),
h_tqdm.ProgressBar("Naturf DAG"),
tracker,
]
6 changes: 6 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Release notes
This is the list of changes to **naturf** between each release. For full details,
see the `commit logs <https://github.com/IMMM-SFA/naturf/commits>`_.

Version 1.0.2
_____________

- See the `v1.0.2 release notes <https://github.com/IMMM-SFA/naturf/releases/tag/v1.0.2>`_.


Version 1.0.1
_____________

Expand Down
Loading