From 5cb52da6a1301dabc374685773640648940fa718 Mon Sep 17 00:00:00 2001 From: Jordan Laser Date: Mon, 12 Feb 2024 14:26:16 -0700 Subject: [PATCH] default to v20.1 --- .../src/forcingprocessor/weights_parq2json.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/forcingprocessor/src/forcingprocessor/weights_parq2json.py b/forcingprocessor/src/forcingprocessor/weights_parq2json.py index e6085122..6be14eb4 100644 --- a/forcingprocessor/src/forcingprocessor/weights_parq2json.py +++ b/forcingprocessor/src/forcingprocessor/weights_parq2json.py @@ -7,7 +7,9 @@ import pyarrow.compute as pc import pyarrow.dataset -def get_weight_json(catchments,jproc): +def get_weight_json(catchments,jproc,version=None): + if version is None: version = "v20.1" + weight_data = {} ncatch = len(catchments) @@ -38,12 +40,10 @@ def get_weight_json(catchments,jproc): parser.add_argument('--gpkg', dest="geopackage", type=str, help="Path to geopackage file",default = None) parser.add_argument('--outname', dest="weights_filename", type=str, help="Filename for the weight file") parser.add_argument('--version', dest="version", type=str, help="Hydrofabric version e.g. \"v21\"") - args = parser.parse_args() + args = parser.parse_args() - global version version = args.version - - weight_versions = ["v20.1"] + weight_versions = ["v20.1",None] if version not in weight_versions: raise Exception(f'version must one of: {weight_versions}') @@ -57,7 +57,7 @@ def get_weight_json(catchments,jproc): import geopandas as gpd gpd.options.io_engine = "pyogrio" catchments = gpd.read_file(args.geopackage, layer='divides') - catchment_list = sorted(list(catchments['divide_id'])) + catchment_list = sorted(list(catchments['divide_id'])) nprocs = os.cpu_count() - 2 catchment_list_list = []