@@ -39,8 +39,8 @@ def main(cfg):
3939 )
4040
4141 # read shapefile
42- idvar = cfg .shapefiles [cfg .shapefile_polygon_name ][cfg .shapefile_year ].idvar
43- shp_path = f"data/input/shapefiles/shapefile_ { cfg .shapefile_polygon_name } _{ cfg .shapefile_year } /shapefile .shp"
42+ idvar = cfg .shapefiles [cfg .shapefile_polygon_name ][cfg .shapefile_tag ].idvar
43+ shp_path = f"data/input/shapefiles/{ cfg .shapefile_polygon_name } _{ cfg .shapefile_tag } / { cfg . shapefile_polygon_name } _ { cfg . shapefile_tag } .shp"
4444 LOGGER .info (f"Reading shapefile { shp_path } " )
4545 shp = gpd .read_file (shp_path )
4646 LOGGER .info (f"Read shapefile with head\n : { shp .drop (columns = 'geometry' ).head ()} " )
@@ -91,7 +91,7 @@ def main(cfg):
9191 LOGGER .info (f"Fraction of locations with ties: { 100 * frac_ties :.2f} %" )
9292
9393 intermediate_dir = f"data/intermediate/climate_pcts"
94- pcts_file = f"{ intermediate_dir } /climate_pcts_{ cfg .shapefile_polygon_name } _{ cfg .shapefile_year } .json"
94+ pcts_file = f"{ intermediate_dir } /climate_pcts_{ cfg .shapefile_polygon_name } _{ cfg .shapefile_tag } .json"
9595 LOGGER .info (f"Saving pcts to { pcts_file } " )
9696 with open (pcts_file , "w" ) as f :
9797 json .dump (avs , f )
@@ -107,7 +107,7 @@ def main(cfg):
107107 class_df ["climate_type_long" ] = class_df ["climate_type_num" ].map (codedict_long ) # if a polygon intersects only with water then there is no assignment
108108 class_df = class_df .drop (columns = "climate_type_num" )
109109
110- class_file = f"{ intermediate_dir } /climate_types_{ cfg .shapefile_polygon_name } _{ cfg .shapefile_year } .csv"
110+ class_file = f"{ intermediate_dir } /climate_types_{ cfg .shapefile_polygon_name } _{ cfg .shapefile_tag } .csv"
111111 LOGGER .info (f"Saving classification to { class_file } " )
112112 class_df .to_csv (class_file , index = False )
113113
@@ -123,7 +123,7 @@ def main(cfg):
123123
124124 output_df = pd .merge (class_df , output_df , on = "id" )
125125
126- output_file = f"data/output/climate_types_raster2polygon/climate_types_{ cfg .shapefile_polygon_name } _{ cfg .shapefile_year } .parquet"
126+ output_file = f"data/output/climate_types_raster2polygon/climate_types_{ cfg .shapefile_polygon_name } _{ cfg .shapefile_tag } .parquet"
127127 LOGGER .info (f"Saving output to { output_file } " )
128128 output_df .rename (columns = {"id" : cfg .shapefile_polygon_name }, inplace = True )
129129 output_df .to_parquet (output_file )
0 commit comments