Name | rashdf JSON |
Version |
0.7.1
JSON |
| download |
home_page | None |
Summary | Read data from HEC-RAS HDF files. |
upload_time | 2024-11-26 20:46:47 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# rashdf
[![CI](https://github.com/fema-ffrd/rashdf/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/fema-ffrd/rashdf/actions/workflows/continuous-integration.yml)
[![Release](https://github.com/fema-ffrd/rashdf/actions/workflows/release.yml/badge.svg)](https://github.com/fema-ffrd/rashdf/actions/workflows/release.yml)
[![PyPI version](https://badge.fury.io/py/rashdf.svg)](https://badge.fury.io/py/rashdf)
[![codecov](https://codecov.io/gh/fema-ffrd/rashdf/graph/badge.svg?token=CTIIONEHV1)](https://codecov.io/gh/fema-ffrd/rashdf)
[![Documentation Status](https://readthedocs.org/projects/rashdf/badge/?version=latest)](https://rashdf.readthedocs.io/en/latest/?badge=latest)
Read data from [HEC-RAS](https://www.hec.usace.army.mil/software/hec-ras/) [HDF](https://github.com/HDFGroup/hdf5) files.
*Pronunciation: `raz·aitch·dee·eff`*
## Documentation
[rashdf on ReadTheDocs](http://rashdf.readthedocs.io/)
## Install
```bash
$ pip install rashdf
```
## Usage
`RasGeomHdf` and `RasPlanHdf` are extensions of
[h5py.File](https://docs.h5py.org/en/stable/high/file.html#h5py.File). They contain
methods to export HEC-RAS model geometry as
[GeoDataFrame](https://geopandas.org/en/stable/docs/reference/geodataframe.html)
objects.
```python
>>> from rashdf import RasGeomHdf
>>> geom_hdf = RasGeomHdf("path/to/rasmodel/Muncie.g04.hdf")
>>> mesh_cells = geom_hdf.mesh_cell_polygons() # export a GeoDataFrame
>>> mesh_cells
mesh_name cell_id geometry
0 2D Interior Area 0 POLYGON ((406025.000 1805015.237, 406025.000 1...
1 2D Interior Area 1 POLYGON ((406075.000 1805018.545, 406075.000 1...
2 2D Interior Area 2 POLYGON ((406075.000 1804975.000, 406075.000 1...
3 2D Interior Area 3 POLYGON ((406125.000 1804975.000, 406125.000 1...
4 2D Interior Area 4 POLYGON ((406175.000 1804975.000, 406175.000 1...
... ... ... ...
5386 2D Interior Area 5386 POLYGON ((409163.402 1802463.621, 409175.000 1...
5387 2D Interior Area 5387 POLYGON ((409160.953 1802374.120, 409125.000 1...
5388 2D Interior Area 5388 POLYGON ((409163.402 1802463.621, 409161.906 1...
5389 2D Interior Area 5389 POLYGON ((409112.480 1802410.114, 409112.046 1...
5390 2D Interior Area 5390 POLYGON ((409112.480 1802410.114, 409063.039 1...
>>> mesh_cells.to_file("mucie-mesh-cell-polygons.shp")
```
Also, methods to extract certain HDF group attributes as dictionaries:
```python
>>> from rashdf import RasPlanHdf
>>> with RasPlanHdf("path/to/rasmodel/Muncie.p04.hdf") as plan_hdf:
>>> results_unsteady_summary_attrs = plan_hdf.get_results_unsteady_summary_attrs()
>>> results_unsteady_summary_attrs
{'Computation Time DSS': datetime.timedelta(0),
'Computation Time Total': datetime.timedelta(seconds=23),
'Maximum WSEL Error': 0.0099277812987566,
'Maximum number of cores': 6,
'Run Time Window': [datetime.datetime(2024, 3, 27, 9, 31, 52),
datetime.datetime(2024, 3, 27, 9, 32, 15)],
'Solution': 'Unsteady Finished Successfully',
'Time Solution Went Unstable': None,
'Time Stamp Solution Went Unstable': 'Not Applicable'}
```
## CLI
The `rashdf` command-line interface allows export directly to a variety of formats, enabled
by GeoPandas.
```
$ rashdf <sub-command> <hdf-file> [<output-path>] [<options>]
```
CLI help:
```
$ rashdf --help
```
Print the output formats supported by pyorgio:
```
$ rashdf --pyogrio-drivers
```
Help for a specific subcommand:
```
$ rashdf mesh_cell_polygons --help
```
Example: export mesh cell faces to an ESRI Shapefile
```
$ rashdf mesh_cell_faces BigRiver.g01.hdf big-river-mesh-cell-faces.shp
```
Example: export mesh cell points to GeoParquet
```
$ rashdf mesh_cell_points LittleCreek.g01.hdf --parquet little-creek-mesh-cell-points.parquet
```
Example: export breaklines to OGC GeoPackage and reproject to a different CRS
```
$ rashdf breaklines Whitemarsh.p01.hdf whitemarsh-breaklines.gpkg --to-crs EPSG:4326
```
Example: write structures GeoJSON to `stdout`:
```
$ rashdf structures Potomac.p01.hdf
```
## Developer Setup
Create a virtual environment in the project directory:
```
$ python -m venv venv-rashdf
```
Activate the virtual environment:
```
# For macOS/Linux
$ source ./venv-rashdf/bin/activate
(venv-rashdf) $
# For Windows
> ./venv-rashdf/Scripts/activate
```
Install dev dependencies:
```
(venv-rashdf) $ pip install ".[dev]"
```
Install git hook scripts (used for automatic liniting/formatting)
```
(venv-rashdf) $ pre-commit install
```
With the virtual environment activated, run the tests:
```
(venv-rashdf) $ pytest
```
Raw data
{
"_id": null,
"home_page": null,
"name": "rashdf",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/8c/1e/ca3ea559a23af9f844a03809b2a9c864d39eb8b4e6e2dadbc5af66300e83/rashdf-0.7.1.tar.gz",
"platform": null,
"description": "# rashdf\n[![CI](https://github.com/fema-ffrd/rashdf/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/fema-ffrd/rashdf/actions/workflows/continuous-integration.yml)\n[![Release](https://github.com/fema-ffrd/rashdf/actions/workflows/release.yml/badge.svg)](https://github.com/fema-ffrd/rashdf/actions/workflows/release.yml)\n[![PyPI version](https://badge.fury.io/py/rashdf.svg)](https://badge.fury.io/py/rashdf)\n[![codecov](https://codecov.io/gh/fema-ffrd/rashdf/graph/badge.svg?token=CTIIONEHV1)](https://codecov.io/gh/fema-ffrd/rashdf)\n[![Documentation Status](https://readthedocs.org/projects/rashdf/badge/?version=latest)](https://rashdf.readthedocs.io/en/latest/?badge=latest)\n\nRead data from [HEC-RAS](https://www.hec.usace.army.mil/software/hec-ras/) [HDF](https://github.com/HDFGroup/hdf5) files.\n\n*Pronunciation: `raz\u00b7aitch\u00b7dee\u00b7eff`*\n\n## Documentation\n[rashdf on ReadTheDocs](http://rashdf.readthedocs.io/)\n\n## Install\n```bash\n$ pip install rashdf\n```\n\n## Usage\n`RasGeomHdf` and `RasPlanHdf` are extensions of\n[h5py.File](https://docs.h5py.org/en/stable/high/file.html#h5py.File). They contain\nmethods to export HEC-RAS model geometry as\n[GeoDataFrame](https://geopandas.org/en/stable/docs/reference/geodataframe.html)\nobjects.\n```python\n>>> from rashdf import RasGeomHdf\n>>> geom_hdf = RasGeomHdf(\"path/to/rasmodel/Muncie.g04.hdf\")\n>>> mesh_cells = geom_hdf.mesh_cell_polygons() # export a GeoDataFrame\n>>> mesh_cells\n mesh_name cell_id geometry\n0 2D Interior Area 0 POLYGON ((406025.000 1805015.237, 406025.000 1...\n1 2D Interior Area 1 POLYGON ((406075.000 1805018.545, 406075.000 1...\n2 2D Interior Area 2 POLYGON ((406075.000 1804975.000, 406075.000 1...\n3 2D Interior Area 3 POLYGON ((406125.000 1804975.000, 406125.000 1...\n4 2D Interior Area 4 POLYGON ((406175.000 1804975.000, 406175.000 1...\n... ... ... ...\n5386 2D Interior Area 5386 POLYGON ((409163.402 1802463.621, 409175.000 1...\n5387 2D Interior Area 5387 POLYGON ((409160.953 1802374.120, 409125.000 1...\n5388 2D Interior Area 5388 POLYGON ((409163.402 1802463.621, 409161.906 1...\n5389 2D Interior Area 5389 POLYGON ((409112.480 1802410.114, 409112.046 1...\n5390 2D Interior Area 5390 POLYGON ((409112.480 1802410.114, 409063.039 1...\n>>> mesh_cells.to_file(\"mucie-mesh-cell-polygons.shp\")\n```\n\nAlso, methods to extract certain HDF group attributes as dictionaries:\n```python\n>>> from rashdf import RasPlanHdf\n>>> with RasPlanHdf(\"path/to/rasmodel/Muncie.p04.hdf\") as plan_hdf:\n>>> results_unsteady_summary_attrs = plan_hdf.get_results_unsteady_summary_attrs()\n>>> results_unsteady_summary_attrs\n{'Computation Time DSS': datetime.timedelta(0),\n'Computation Time Total': datetime.timedelta(seconds=23),\n'Maximum WSEL Error': 0.0099277812987566,\n'Maximum number of cores': 6,\n'Run Time Window': [datetime.datetime(2024, 3, 27, 9, 31, 52),\ndatetime.datetime(2024, 3, 27, 9, 32, 15)],\n'Solution': 'Unsteady Finished Successfully',\n'Time Solution Went Unstable': None,\n'Time Stamp Solution Went Unstable': 'Not Applicable'}\n```\n\n## CLI\nThe `rashdf` command-line interface allows export directly to a variety of formats, enabled\nby GeoPandas.\n```\n$ rashdf <sub-command> <hdf-file> [<output-path>] [<options>]\n```\n\nCLI help:\n```\n$ rashdf --help\n```\n\nPrint the output formats supported by pyorgio:\n```\n$ rashdf --pyogrio-drivers\n```\n\nHelp for a specific subcommand:\n```\n$ rashdf mesh_cell_polygons --help\n```\n\nExample: export mesh cell faces to an ESRI Shapefile\n```\n$ rashdf mesh_cell_faces BigRiver.g01.hdf big-river-mesh-cell-faces.shp\n```\n\nExample: export mesh cell points to GeoParquet\n```\n$ rashdf mesh_cell_points LittleCreek.g01.hdf --parquet little-creek-mesh-cell-points.parquet\n```\n\nExample: export breaklines to OGC GeoPackage and reproject to a different CRS\n```\n$ rashdf breaklines Whitemarsh.p01.hdf whitemarsh-breaklines.gpkg --to-crs EPSG:4326\n```\n\nExample: write structures GeoJSON to `stdout`:\n```\n$ rashdf structures Potomac.p01.hdf\n```\n\n## Developer Setup\nCreate a virtual environment in the project directory:\n```\n$ python -m venv venv-rashdf\n```\n\nActivate the virtual environment:\n```\n# For macOS/Linux\n$ source ./venv-rashdf/bin/activate\n(venv-rashdf) $\n\n# For Windows\n> ./venv-rashdf/Scripts/activate\n```\n\nInstall dev dependencies:\n```\n(venv-rashdf) $ pip install \".[dev]\"\n```\n\nInstall git hook scripts (used for automatic liniting/formatting)\n```\n(venv-rashdf) $ pre-commit install\n```\n\nWith the virtual environment activated, run the tests:\n```\n(venv-rashdf) $ pytest\n```\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Read data from HEC-RAS HDF files.",
"version": "0.7.1",
"project_urls": {
"repository": "https://github.com/fema-ffrd/rashdf"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8f53ecec54dee517a72148afb015e3382f612d80a95ee2881f5265ec748bb8a7",
"md5": "c71f7e91e87aef113e2abbf3bfd6c459",
"sha256": "3ef3a0904c072473b45ebcb5e1f8a0a5f46887415a371d84e1ae81784b9afa02"
},
"downloads": -1,
"filename": "rashdf-0.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c71f7e91e87aef113e2abbf3bfd6c459",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 25680,
"upload_time": "2024-11-26T20:46:46",
"upload_time_iso_8601": "2024-11-26T20:46:46.204764Z",
"url": "https://files.pythonhosted.org/packages/8f/53/ecec54dee517a72148afb015e3382f612d80a95ee2881f5265ec748bb8a7/rashdf-0.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8c1eca3ea559a23af9f844a03809b2a9c864d39eb8b4e6e2dadbc5af66300e83",
"md5": "344d6ba3c16803acb747fc5eac203dce",
"sha256": "8d44628e26c2524468d336470121d2a05158cfd9e1d7b85586297135ad951ee4"
},
"downloads": -1,
"filename": "rashdf-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "344d6ba3c16803acb747fc5eac203dce",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 32535,
"upload_time": "2024-11-26T20:46:47",
"upload_time_iso_8601": "2024-11-26T20:46:47.760787Z",
"url": "https://files.pythonhosted.org/packages/8c/1e/ca3ea559a23af9f844a03809b2a9c864d39eb8b4e6e2dadbc5af66300e83/rashdf-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-26 20:46:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fema-ffrd",
"github_project": "rashdf",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "rashdf"
}