hipims_io
Python code to process input and output files of HiPIMS flood model. This code follows Google Python Style Guide.
Python version: >=3.6. The main content of this package is also included in a Python API of HiPIMS.
To install hipims_io from command window/terminal:
pip install hipims_io
To install using github repo:
git clone https://github.com/mingxiaodong/hipims_io_python.git
cd hipims_io_python
pip install .
A quick demonstration to setup a HiPIMS input object with a sample DEM:
import hipims_io as hp
obj_in = hp.demo_input() # create an input object and show domain map
A quick demonstration to setup a HiPIMS input object with a data path contaning the following files:
- DEM.gz/.asc/.tif (essential file, in projected crs)
- rain_mask.gz/.asc/.tif (optional file for setting rainfall, having the same crs with DEM)
- rain_source.csv (optional file for setting rainfall rate in timeseries]
- landcover.gz/.asc/.tif (optional file for setting landcover-based parameters, having the same crs with DEM)
import os
import hipims_io as hp
from hipims_io.demo_functions import get_sample_data
dem_path, _ = get_sample_data(return_path=True) # get the path of sample data
data_path = os.path.dirname(dem_path)
case_folder = os.path.join(os.getcwd(), 'hipims_case') # define a case folder in the current directory
obj_in = hp.InputHipims(case_folder=case_folder, num_of_sections=1,
data_path=data_path) # create input object
obj_in.domain_show() # show domain map
print(obj_in) # show case information
A step-by-step tutorial to setup a HiPIMS input object with sample data:
import os
import numpy as np
import hipims_io as hp
dem_file, model_data, _ = hp.get_sample_data() # get sample data
case_folder = os.path.join(os.getcwd(), 'hipims_case') # define a case folder in the current directory
# create a single-gpu input object
obj_in = hp.InputHipims(dem_data=dem_file, num_of_sections=1, case_folder=case_folder)
# set a initial water depth of 0.5 m
obj_in.set_initial_condition('h0', 0.5)
# set boundary condition
bound_list = model_data['boundary_condition'] # with boundary information
obj_in.set_boundary_condition(bound_list, outline_boundary='fall')
# set rainfall mask and source
rain_source = model_data['rain_source']
obj_in.set_rainfall(rain_mask=0, rain_source=rain_source)
# set manning parameter
manning_array = np.zeros(obj_in.DEM.shape)+0.03 # create an array with the same shape of the DEM array
obj_in.set_grid_parameter(manning=manning_array)
# set monitor positions
gauges_pos = model_data['gauges_pos']
obj_in.set_gauges_position(gauges_pos)
# display model information
obj_in.domain_show() # show domain map
print(obj_in) # print model summary
# write all input files for HiPIMS to the case folder
obj_in.write_input_files()
The domain map will be shown like this:
Metadata
Release files for hipims-io 0.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hipims_io-0.6.3.tar.gz | 142.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hipims_io-0.6.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 303.2 kB
Release files / hipims_io-0.6.3.tar.gz
| Download URL | hipims_io-0.6.3.tar.gz |
|---|---|
| Size | 142.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b8d187a49ab63febe65f30351d7d80c61f2e3c8cef432d513416c148967069e
|
|
BLAKE2b-256 checksum How to use checksums |
cc898fa880603c5f5ed19d0cbcc884bf61a6ba9945a7b8c30cc69f9f0e4df3a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.3
|
Release files / hipims_io-0.6.3-py3-none-any.whl
| Download URL | hipims_io-0.6.3-py3-none-any.whl |
|---|---|
| Size | 161.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ceb29f9c11185c2f900b5804037a32d2137ab23a86ba232a72eb774e5d62fbbe
|
|
BLAKE2b-256 checksum How to use checksums |
05bdda16e016f137c8f9b32411c81247be3676b997e77960a86db3b1ad6d7735
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.3
|