import pandas as pd import datetime from datetime import timedelta #import flow dev data FileHandle = FileHandler() #Paths to files #dev_data_path = "integrated/Modules/Ecology/Inputs" dev_data_path = "Inputs" # Read in flow data #flow_data_path = "integrated/Modules/Ecology/Inputs/Hydrology/sce1/406201.csv" #201,202, 265 flow_data_path = dev_data_path+"/Hydrology/sce1/406201.csv" flow_data = FileHandle.loadCSV(flow_data_path, index_col="Date", parse_dates=True, dayfirst=True) flow_data[flow_data<0] = np.nan flow_col = "Flow" #import environmental flow requirement data #eflow_req_path = "integrated/Modules/Ecology/Inputs/Ecology/Platypus_flow_req.csv" eflow_req_path = dev_data_path+"/Ecology/Platypus_flow_req.csv" eflow_req = FileHandle.loadCSV(eflow_req_path) # minimum duration requirements for low flow index summerlowday = 120 winterlowday = 60 #winter low is limiting the low flow index -> u/c required # inputs for food index and dispersal index durations = {
### Script starts here ### FileHandle = FileHandler() #Read in input data ## Read in input data # read in all breakpoint files from 1900 til end of file date_range = ["1900-01-01", None] indexes = FileHandle.importFiles("Inputs/index", ext=".csv", walk=False) # read in asset table #This could be set as class attribute as it is used as a global in the R script asset_table = FileHandle.loadCSV("Inputs/ctf_dss.csv") # read in weights weightall = FileHandle.loadCSV("Inputs/index/weight/weight.csv") # Set up additional parameters: # Set up weight for groundwater index gweight = 0.2 #scenarios = FileHandle.getFolders('Inputs/') scenarios = ["Inputs/Hist"] #FileHandle.getFolders('Inputs/') # For DSS, can use RRGMS only as a minimum. specieslist = [ "RRGMS", "RRGRR", "BBMS", "BBRR", "LGMS", "LGRR", "WCMS", "WCRR" ]
dev_data_path = "Integrated/Modules/Ecology/Inputs" #dev_data_path = "Inputs" # Read in flow data scenarios = [dev_data_path+"/Hydrology/sce1"]#, dev_data_path+"/Hydrology/sce2"] date_range = ["1900-01-01", None] # Read in index data # NOTE: Left most column will be used as the DataFrame index indexes = FileHandle.importFiles(dev_data_path+"/Ecology/index", ext=".csv", index_col=0, walk=False) indexes = indexes["index"] #Remove parent folder listing from Dict, as this is unneeded # read in asset table #This could be set as class attribute as it is used as a global in the R script asset_table = FileHandle.loadCSV(dev_data_path+"/Ecology/Water_suitability_param.csv") eco_assets = ['A2','A4','A5'] # read in weights weights = indexes["weights"] #change headers to lowercase to make it consistent with other csvs weights.columns = [x.lower() for x in weights.columns] # Set up additional parameters: # Set up weight for groundwater index gw_weight = 0.4 sw_weight = 0.6 # For DSS, can use RRGMS only as a minimum. specieslist = ["RRGMS","RRGRR"]
import datetime from datetime import timedelta #import flow dev data FileHandle = FileHandler() #Paths to files #dev_data_path = "integrated/Modules/Ecology/Inputs" dev_data_path = "Inputs" # Read in flow data #flow_data_path = "integrated/Modules/Ecology/Inputs/Hydrology/sce1/406201.csv" #201,202, 265 flow_data_path = dev_data_path + "/Hydrology/sce1/406201.csv" flow_data = FileHandle.loadCSV(flow_data_path, index_col="Date", parse_dates=True, dayfirst=True) flow_data[flow_data < 0] = np.nan flow_col = "Flow" #import environmental flow requirement data #eflow_req_path = "integrated/Modules/Ecology/Inputs/Ecology/Platypus_flow_req.csv" eflow_req_path = dev_data_path + "/Ecology/Platypus_flow_req.csv" eflow_req = FileHandle.loadCSV(eflow_req_path) # minimum duration requirements for low flow index summerlowday = 120 winterlowday = 60 #winter low is limiting the low flow index -> u/c required # inputs for food index and dispersal index
temp_data['irrigation_name'] = irrigation_name irrigation_params[irrigation_name] = ParameterSet(**temp_data) globals()[irrigation_name+"_params"] = irrigation_params[irrigation_name] temp_params = irrigation_params[irrigation_name].getParams() temp_params['name'] = irrigation_name globals()[irrigation_name] = IrrigationPractice(**temp_params) #End for #End for #Pumping System DieselPump = DataHandle.loadCSV('PumpingSystems/data/shallow.csv', index_col=0, skipinitialspace=True) DieselPump = Pumps(name='Diesel Pump', **DieselPump['Best Guess'].to_dict()) NoPump = DataHandle.loadCSV('PumpingSystems/data/no_pump.csv', index_col=0, skipinitialspace=True) NoPump = Pumps(name='No Pump', **NoPump['Best Guess'].to_dict()) #Crops crop_data_files = DataHandle.importFiles('Crops/data/variables', walk=True, index_col=0, skipinitialspace=True) crop_data = {} crop_params = {} for folder in crop_data_files: for crop_name in crop_data_files[folder]: crop_data[crop_name] = crop_data_files[folder][crop_name] temp_data = crop_data[crop_name]['Best Guess'].to_dict() temp_data['crop_name'] = crop_name
] #, dev_data_path+"/Hydrology/sce2"] date_range = ["1900-01-01", None] # Read in index data # NOTE: Left most column will be used as the DataFrame index indexes = FileHandle.importFiles(dev_data_path + "/Ecology/index", ext=".csv", index_col=0, walk=False) indexes = indexes[ "index"] #Remove parent folder listing from Dict, as this is unneeded # read in asset table #This could be set as class attribute as it is used as a global in the R script asset_table = FileHandle.loadCSV(dev_data_path + "/Ecology/Water_suitability_param.csv") eco_assets = ['A2', 'A4', 'A5'] # read in weights weights = indexes["weights"] #change headers to lowercase to make it consistent with other csvs weights.columns = [x.lower() for x in weights.columns] # Set up additional parameters: # Set up weight for groundwater index gw_weight = 0.4 sw_weight = 0.6 # For DSS, can use RRGMS only as a minimum. specieslist = ["RRGMS", "RRGRR"]