easy_vic_build.build_hydroanalysis
build_hydroanalysis - A Python module for performing hydrological analysis at level 1.
This module provides functions for performing hydroanalysis tasks, such as creating a Digital Elevation Model (DEM), calculating flow direction, flow accumulation, and flow distance. It supports two packages for calculating flow direction: “arcpy” and “wbw”, and allows the user to define a pour point for localized flow direction calculations. Note that this analysis is performed at level 1, aiming at getting the hydrography information at modeling scale.
Functions:
buildHydroanalysis: Performs the hydroanalysis process, including DEM generation, flow direction and accumulation calculation, and flow distance calculation. The function supports both “arcpy” and “wbw” packages for flow direction calculation.
Usage:
Provide the necessary datasets (e.g., parameters and domain datasets), along with optional configuration settings such as pour point location and flow direction package.
Call buildHydroanalysis to perform the entire hydroanalysis
Example:
basin_index = 213 model_scale = “6km” date_period = [“19980101”, “19981231”] case_name = f”{basin_index}_{model_scale}”
evb_dir = Evb_dir(cases_home=”./examples”) # cases_home=”/home/xdz/code/VIC_xdz/cases” evb_dir.builddir(case_name) remove_and_mkdir(evb_dir.RVICParam_dir) evb_dir.builddir(case_name)
domain_dataset = readDomain(evb_dir) params_dataset_level0, params_dataset_level1 = readParam(evb_dir)
- buildHydroanalysis(evb_dir, params_dataset_level1, domain_dataset, reverse_lat=True, flow_direction_pkg=”wbw”, crs_str=”EPSG:4326”,
create_stream=True, pourpoint_lon=None, pourpoint_lat=None, pourpoint_direction_code=None)
domain_dataset.close() params_dataset_level0.close() params_dataset_level1.close()
Dependencies:
rasterio: For reading and writing geospatial raster data.
shutil: For file operations like copying and removing directories.
tools.geo_func: For geometric calculations and spatial operations.
tools.hydroanalysis_func: For performing hydroanalysis.
tools.utilities: Custom utility functions.
Functions
|
|
|
Perform hydroanalysis tasks to generate DEM, flow direction, flow accumulation, and flow distance. |
- easy_vic_build.build_hydroanalysis.buildHydroanalysis_level0(evb_dir, dem_level0_path, flow_direction_pkg='wbw', **kwargs)[source]
- easy_vic_build.build_hydroanalysis.buildHydroanalysis_level1(evb_dir, params_dataset_level1, domain_dataset, reverse_lat=True, stream_acc_threshold=None, flow_direction_pkg='wbw', crs_str='EPSG:4326', **kwargs)[source]
Perform hydroanalysis tasks to generate DEM, flow direction, flow accumulation, and flow distance. The results are saved in specified directories and can be used for further analysis or modeling.
- Parameters:
evb_dir (Evb_dir) – An instance of the Evb_dir class, containing paths for VIC deployment.
params_dataset_level1 (netCDF.Dataset) – The parameter dataset for level 1, containing the parameters (e.g., latitude, longitude) for DEM creation.
domain_dataset (netCDF.Dataset, optional) – Domain dataset domain information such as x and y lengths.
reverse_lat (bool) – Boolean flag to indicate whether to reverse latitudes (Northern Hemisphere: large -> small, set as True).
stream_acc_threshold (float, optional) – The threshold value for stream accumulation. Default is 100.0.
flow_direction_pkg (str, optional) – The package used to calculate flow direction. Options are “arcpy” and “wbw”. Default is “wbw”.
crs_str (str, optional) – The coordinate reference system string. Default is “EPSG:4326”.
pourpoint_lon (float, optional) – Longitude of the pour point location (corresponding to the coord at level1). Default is None.
pourpoint_lat (float, optional) – Latitude of the pour point location. Default is None.
pourpoint_direction_code (int, optional) – The direction code of the pour point. Default is None.
- Returns:
The function generates several output files (e.g., DEM, flow direction, flow accumulation, flow distance) and saves them in the specified directory.
- Return type:
None