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

Feature/issue 85 - Add variable units to API response #120

Merged
merged 6 commits into from
Mar 28, 2024

Conversation

nikki-t
Copy link
Collaborator

@nikki-t nikki-t commented Mar 21, 2024

Github Issue: #85

Description

Add variable units to API response.

Overview of work done

Parsed units from DynamoDB query results and added them to the GeoPandas GeoDataFrame object which includes the units in the API response.

Note that units are present for each feature in the FeatureCollection GeoJSON response.

Overview of verification done

Updated existing GeoJSON and CSV unit tests to include units. Created a new unit test to test the add_units function which matches use specified fields with units. All units test pass.

Overview of integration done

Deployed modifications to SIT environment and ran the following queries.

Normal Execution (GeoJSON)

curl --location --request GET 'https://soto.podaac.sit.earthdatacloud.nasa.gov/hydrocron/v1/timeseries?feature=Reach&feature_id=85206000551&output=geojson&start_time=2023-11-22T00:00:00Z&end_time=2024-03-15T00:00:00Z&fields=reach_id,time_str,width,wse,slope'
{
    "status": "200 OK",
    "time": 462.435,
    "hits": 1,
    "results": {
        "csv": "",
        "geojson": {
            "type": "FeatureCollection",
            "features": [
                {
                    "id": "0",
                    "type": "Feature",
                    "properties": {
                        "reach_id": "85206000551",
                        "time_str": "no_data",
                        "width": "-999999999999.0",
                        "wse": "-999999999999.0",
                        "slope": "-999999999999.0",
                        "width_units": "m",
                        "wse_units": "m",
                        "slope_units": "m/m"
                    },
                    "geometry": {
                        "type": "LineString",
                        "coordinates": [
                            [
                                -71.041492,
                                68.422154
                            ]
                        ]
                    }
                }
            ]
        }
    }
}

(coordinates values trimmed to preserve space)

Normal Execution (CSV)

curl --location --request GET 'https://soto.podaac.sit.earthdatacloud.nasa.gov/hydrocron/v1/timeseries?feature=Reach&feature_id=85206000551&output=csv&start_time=2023-11-22T00:00:00Z&end_time=2024-03-15T00:00:00Z&fields=reach_id,time_str,width,wse,slope'
{
    "status": "200 OK",
    "time": 595.052,
    "hits": 1,
    "results": {
        "csv": "reach_id,time_str,width,wse,slope,width_units,wse_units,slope_units\n85206000551,no_data,-999999999999.0,-999999999999.0,-999999999999.0,m,m,m/m\n",
        "geojson": {}
    }
}

PR checklist:

  • Linted
  • Updated unit tests
  • Updated changelog
  • Integration testing

See Pull Request Review Checklist for pointers on reviewing this pull request

@nikki-t nikki-t requested review from torimcd and frankinspace March 21, 2024 13:51
@nikki-t nikki-t self-assigned this Mar 21, 2024
@nikki-t nikki-t linked an issue Mar 21, 2024 that may be closed by this pull request
@frankinspace frankinspace changed the title Feature/issue 85 Feature/issue 85 - Add variable units to API response Mar 27, 2024
@frankinspace frankinspace merged commit 720a980 into develop Mar 28, 2024
1 check passed
@frankinspace frankinspace deleted the feature/issue-85 branch March 28, 2024 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add variable units to API response
3 participants