Skip to main content

To process input and output files of the HiPIMS model

Project description

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. To use the full function of this package for processing raster and shapefile, gdal and pyshp are required.

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 = hpio.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 hpio
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 = hpio.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 hpio

dem_file, model_data, _ = hpio.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 = hpio.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:

Domain map

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hipims_io-0.5.6.tar.gz (52.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hipims_io-0.5.6-py3-none-any.whl (159.3 kB view details)

Uploaded Python 3

File details

Details for the file hipims_io-0.5.6.tar.gz.

File metadata

  • Download URL: hipims_io-0.5.6.tar.gz
  • Upload date:
  • Size: 52.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for hipims_io-0.5.6.tar.gz
Algorithm Hash digest
SHA256 b2a4f81caee3a6673c14de5c48396160985b4ff20d57370b2aaacb10e4b169a0
MD5 dbe17de91ace14b32bf667c40e5f58ef
BLAKE2b-256 deda4d503d856d3cef5bd4d30dba2aed89dd0f3c1748d8b1eda7e684c1cbb351

See more details on using hashes here.

File details

Details for the file hipims_io-0.5.6-py3-none-any.whl.

File metadata

  • Download URL: hipims_io-0.5.6-py3-none-any.whl
  • Upload date:
  • Size: 159.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for hipims_io-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 31028fd4091ad49a7e6b1c1bcd81ddf1ee8c5d4df671f1feda98c8c77b67924b
MD5 b0f650315e381deabac8c377f4eebd45
BLAKE2b-256 9ef35b8f6c9f6bf31c3c264c5079420a022db007a674e4b5f7875057622a47c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page