MESH-Model / MESH-Scripts

This repository is for sharing and improving pre-processing, post-processing, and run scripts for the MESH hydrology land-surface model.
9 stars 9 forks source link

Hard-coded values in `create_mesh_drainage_database.py` file #39

Open kasra-keshavarz opened 1 year ago

kasra-keshavarz commented 1 year ago

Problem statement

The following code block is hard-coded (with COMID value) to reflect the properties of the MERIT-Basins database.

if str(input_lc_zh).endswith('.shp'):
    lc_zonal_hist = gpd.read_file(input_lc_zh)                        # read QGIS .shp zonal histogram
    lc_zonal_hist = lc_zonal_hist.sort_values(by=['COMID'])           # sort by COMID for QGIS zonal histogram
elif str(input_lc_zh).endswith('.csv'):
    lc_zonal_hist = pd.read_csv(input_lc_zh)                           # read GIS tool .csv zonal histogram
    lc_zonal_hist = lc_zonal_hist.sort_values(by=['COMID'])           # sort by COMID for GIS tool zonal histogram
else:
    print('Zonal histogram not recognized.')
    exit()

Proposed solution

The hard-coded COMID value needs to be changed to read the segment ID value from the control file as has been provided in the workflow.