-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into Feature/ras_1d
- Loading branch information
Showing
24 changed files
with
436 additions
and
107 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 |
---|---|---|
|
@@ -26,6 +26,7 @@ jobs: | |
os: ["ubuntu-latest"] | ||
|
||
runs-on: ${{ matrix.os }} | ||
environment: ci-env | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -45,6 +46,15 @@ jobs: | |
ruff check | ||
ruff format --check | ||
- name: Test with pytest | ||
- name: Run tests with coverage | ||
run: | | ||
pytest | ||
pytest --cov=src --cov-report term-missing | ||
- name: Run coverage | ||
run: | | ||
coverage xml | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
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 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS, Python version and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: mambaforge-latest | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
# formats: | ||
# - epub | ||
|
||
# Optional but recommended, declare the Python requirements required | ||
# to build your documentation | ||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
conda: | ||
environment: docs/environment.yml |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
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,9 @@ | ||
name: rashdf-docs | ||
channels: | ||
- conda-forge | ||
- defaults | ||
dependencies: | ||
- python=3.9 | ||
- pip | ||
- pip: | ||
- -e ../[docs] |
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,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
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,18 @@ | ||
RasGeomHdf | ||
========== | ||
.. currentmodule:: rashdf | ||
.. autoclass:: RasGeomHdf | ||
:show-inheritance: | ||
:members: projection, | ||
mesh_area_names, | ||
mesh_areas, | ||
mesh_cell_polygons, | ||
mesh_cell_points, | ||
mesh_cell_faces, | ||
bc_lines, | ||
breaklines, | ||
refinement_regions, | ||
structures, | ||
get_geom_attrs, | ||
get_geom_structures_attrs, | ||
get_geom_2d_flow_area_attrs |
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,7 @@ | ||
RasHdf | ||
====== | ||
.. currentmodule:: rashdf | ||
.. autoclass:: RasHdf | ||
:show-inheritance: | ||
:special-members: __init__, | ||
open_uri |
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,11 @@ | ||
RasPlanHdf | ||
========== | ||
.. currentmodule:: rashdf | ||
.. autoclass:: RasPlanHdf | ||
:show-inheritance: | ||
:members: get_plan_info_attrs, | ||
get_plan_param_attrs, | ||
get_meteorology_precip_attrs, | ||
get_results_unsteady_attrs, | ||
get_results_unsteady_summary_attrs, | ||
get_results_volume_accounting_attrs |
Empty file.
Empty file.
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,39 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
import sys | ||
|
||
sys.path.insert(0, "src") | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = "rashdf" | ||
copyright = "2024, fema-ffrd" | ||
author = "fema-ffrd" | ||
release = "0.2.1" | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.autosummary", | ||
"sphinx_rtd_theme", | ||
"numpydoc", | ||
] | ||
|
||
numpydoc_show_class_members = False | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = [] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
# html_theme = "alabaster" | ||
html_theme = "sphinx_rtd_theme" | ||
html_static_path = ["_static"] |
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,102 @@ | ||
.. rashdf documentation master file, created by | ||
sphinx-quickstart on Mon Jun 3 15:55:12 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
rashdf Documentation | ||
==================== | ||
:code:`rashdf` is a library for reading data from `HEC-RAS <https://www.hec.usace.army.mil/software/hec-ras/>`_ | ||
HDF5 files. It is a wrapper around the :code:`h5py` library, and provides an interface with | ||
convenience functions for reading key HEC-RAS geometry data, output data, | ||
and metadata. | ||
|
||
Installation | ||
============ | ||
With :code:`pip`:: | ||
|
||
pip install rashdf | ||
|
||
|
||
Quickstart | ||
========== | ||
Reading geometry from a HEC-RAS geometry HDF file:: | ||
|
||
>>> from rashdf import RasGeomHdf | ||
>>> with RasGeomHdf('Muncie.g05.hdf') as geom_hdf: | ||
... projection = geom_hdf.projection() | ||
... mesh_area_names = geom_hdf.mesh_area_names() | ||
... mesh_areas = geom_hdf.mesh_areas() | ||
... mesh_cell_points = geom_hdf.mesh_cell_points() | ||
>>> projection | ||
<Projected CRS: EPSG:2965> | ||
Name: NAD83 / Indiana East (ftUS) | ||
Axis Info [cartesian]: | ||
- E[east]: Easting (US survey foot) | ||
- N[north]: Northing (US survey foot) | ||
Area of Use: | ||
- undefined | ||
Coordinate Operation: | ||
- name: unnamed | ||
- method: Transverse Mercator | ||
Datum: North American Datum 1983 | ||
- Ellipsoid: GRS 1980 | ||
- Prime Meridian: Greenwich | ||
>>> mesh_area_names | ||
['2D Interior Area', 'Perimeter_NW'] | ||
>>> mesh_areas | ||
mesh_name geometry | ||
0 2D Interior Area POLYGON ((409537.180 1802597.310, 409426.140 1... | ||
1 Perimeter_NW POLYGON ((403914.470 1804971.220, 403008.310 1... | ||
>>> mesh_cell_points | ||
mesh_name cell_id geometry | ||
0 2D Interior Area 0 POINT (406000.000 1805000.000) | ||
1 2D Interior Area 1 POINT (406050.000 1805000.000) | ||
2 2D Interior Area 2 POINT (406100.000 1805000.000) | ||
3 2D Interior Area 3 POINT (406150.000 1805000.000) | ||
4 2D Interior Area 4 POINT (406200.000 1805000.000) | ||
... ... ... ... | ||
5785 Perimeter_NW 514 POINT (403731.575 1804124.860) | ||
5786 Perimeter_NW 515 POINT (403650.619 1804121.731) | ||
5787 Perimeter_NW 516 POINT (403585.667 1804141.139) | ||
5788 Perimeter_NW 517 POINT (403534.818 1804186.902) | ||
5789 Perimeter_NW 518 POINT (403632.837 1804235.708) | ||
|
||
Reading plan data from a HEC-RAS plan HDF file hosted on AWS S3 | ||
(note, this requires installation of the optional :code:`fsspec` | ||
and :code:`s3fs` libraries as well as configuration of S3 | ||
credentials):: | ||
|
||
>>> from rashdf import RasPlanHdf | ||
>>> with RasPlanHdf.open_uri('s3://bucket/ElkMiddle.p01.hdf') as plan_hdf: | ||
... plan_info = plan_hdf.get_plan_info_attrs() | ||
>>> plan_info | ||
{'Base Output Interval': '1HOUR', 'Computation Time Step Base': '1MIN', | ||
'Flow Filename': 'ElkMiddle.u01', 'Flow Title': 'Jan_1996', | ||
'Geometry Filename': 'ElkMiddle.g01', 'Geometry Title': 'ElkMiddle', | ||
'Plan Filename': 'ElkMiddle.p01', 'Plan Name': 'Jan_1996', | ||
'Plan ShortID': 'Jan_1996', 'Plan Title': 'Jan_1996', | ||
'Project Filename': 'g:\\Jan1996_Kanawha_CloudPrep\\Elk Middle\\ElkMiddle.prj', | ||
'Project Title': 'ElkMiddle', | ||
'Simulation End Time': datetime.datetime(1996, 2, 7, 12, 0), | ||
'Simulation Start Time': datetime.datetime(1996, 1, 14, 12, 0), | ||
'Time Window': [datetime.datetime(1996, 1, 14, 12, 0), | ||
datetime.datetime(1996, 2, 7, 12, 0)]} | ||
|
||
|
||
API | ||
=== | ||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
RasGeomHdf | ||
RasPlanHdf | ||
RasHdf | ||
|
||
:code:`rashdf` provides two primary classes for reading data from | ||
HEC-RAS geometry and plan HDF files: :code:`RasGeomHdf` and :code:`RasPlanHdf`. | ||
Both of these classes inherit from the :code:`RasHdf` base class, which | ||
inherits from the :code:`h5py.File` class. | ||
|
||
Note that :code:`RasPlanHdf` inherits from :code:`RasGeomHdf`, so all of the | ||
methods available in :code:`RasGeomHdf` are also available in :code:`RasPlanHdf`. |
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.
Oops, something went wrong.