Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhales committed Aug 20, 2021
1 parent f7a8982 commit 926c7b3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 19 deletions.
17 changes: 12 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
:maxdepth: 3
:numbered:

*******************************************
Grids: Temporal Informatics of Gridded Data
*******************************************
*********************
The Grids Python Tool
*********************

.. image:: https://img.shields.io/pypi/v/grids
:target: https://pypi.org/project/grids
:alt: PYPI Version
.. image:: https://readthedocs.org/projects/tsgrids/badge/?version=latest
:target: https://tsgrids.readthedocs.io/en/latest/?badge=latest
:target: https://grids.rileyhales.com/en/latest/?badge=latest
:alt: Documentation Status

Tools for extracting time series subsets from n-dimensional arrays in NetCDF, GRIB, HDF, and GeoTIFF formats. Time series
Expand All @@ -20,7 +20,14 @@ can be extracted for:
#. Ranges or Bounding Boxes - by specifying the minimum and maximum coordinates for each dimension
#. Spatial data - if the rasters are spatial data and the appropriate dimensions are specified
#. Masks - any irregularly shaped subset of the array which you can create a binary mask array for
#. Statistical summaries - of the entire array

Citations
*********

If you use Grids, please cite

- Our journal article at MDPI Water. doi: `10.3390/w13152066 <https://doi.org/10.3390/w13152066>`_
- The source code through Zenodo. doi: `10.5281/zenodo.5225437 <https://doi.org/10.5281/zenodo.5225437>`_

Installation
************
Expand Down
47 changes: 33 additions & 14 deletions publication_tests/nwm/national_water_model_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
Copyright Riley Chad Hales 2021
All Rights Reserved
"""
import datetime
import os
import shutil
# import datetime
# import os
# import shutil

import pandas as pd
import requests
import glob
import grids
# import requests
# import glob
# import grids

import plotly.express as px
import plotly.graph_objs as go


def calc_most_recent_forecast_datetime(fcrange: str, previous: bool = False, steps_back: int = 1):
Expand Down Expand Up @@ -57,7 +57,7 @@ def get_forecast_data(fcrange: str,
ens_prefix = '_'
else: # elif fcrange == 'long':
# ens_members = (1, 2, 3, 4)
ens_members = (4, )
ens_members = (4,)
timesteps = [f'{(i + 1) * 6:03}' for i in range(120)]
dir = f'{fcrange}_range_mem'
ens_prefix = '_'
Expand Down Expand Up @@ -100,7 +100,8 @@ def get_forecast_data(fcrange: str,


# set path to download the nwm data
path_to_nwm_directory = "/Users/rchales/nwm_data"
# path_to_nwm_directory = "/Users/rchales/nwm_data"

# if os.path.exists(path_to_nwm_directory):
# shutil.rmtree(path_to_nwm_directory)
# os.mkdir(path_to_nwm_directory)
Expand All @@ -126,9 +127,27 @@ def get_forecast_data(fcrange: str,
master_df = pd.read_csv('national_water_model_extracted_timeseries.csv', index_col=0)
master_df.index = pd.to_datetime(master_df.index)

plot = px.line(master_df,
title='National Water Model Time Series Using Grids')
plot.update_xaxes(title='Date / Time (UTC)')
plot.update_yaxes(title='ft^3/sec',)
plot.write_image('national_water_model_extracted_timeseries.svg')
plot_lines = []
for i in (1, 2, 3, 4):
plot_lines.append(
go.Scatter(
x=master_df.index,
y=master_df[f'member_{i}'],
line=dict(color='blue', width=5),
showlegend=False
)
)
for i in (1, 2, 3, 4):
plot_lines.append(
go.Scatter(
x=master_df.index,
y=master_df[f'member_{i}'],
line=dict(color='red', dash='dot'),
showlegend=False
)
)
plot = go.Figure(plot_lines)
plot.update_xaxes(title='Datetime (UTC)')
plot.update_yaxes(title='Forecasted Discharge (ft^3/sec)')
plot.write_image('new_timeseries_plot.png')
plot.show()

0 comments on commit 926c7b3

Please sign in to comment.