Esempio n. 1
0
#   summaryby <- as.POSIXlt(time(x))$year + 1900
#   flowsummary <- aggregate(x, by=summaryby, FUN = fun, na.rm=TRUE)
#   return(round(flowsummary,2))
# }

### 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/')
Esempio n. 2
0
if __name__ == '__main__':

    import numpy as np
    import pandas as pd

    from integrated.Modules.Core.Handlers.FileHandler import FileHandler
    from Hydrology import Hydrology

    import datetime

    #Set up the file handler
    FileHandle = FileHandler()

    #Import all the files from the data directory
    data_path = "data"
    data = FileHandle.importFiles(data_path, ext=".csv", walk=False, dayfirst=True)
    data = data["data"] #Remove parent directory from listing

    #Set node_ids as index where possible
    for name, df in data.iteritems():
        try:
            df.index = df['node']
        except KeyError as e:
            #Doesn't have node column
            #Safe to skip
            continue
        #End try
    #End for

    #Create a Hydrology Object
    Hydro = Hydrology(data)
Esempio n. 3
0
    capital_cost_per_ML_at_02_per_day=700, #TESTING, REMOVE WHEN DONE
    cost_capital=0,
    maintenance_rate=0.07,
    capture_pump_cost_ratio=0.6,
    pump_cost_dollar_per_ML=35,
    ClimateVariables=ParameterSet(surface_evap_rate=0.4),
    # WaterSources=WaterSources(water_source={'flood_harvest': 200})
)

### Import data from files ###

DataHandle = FileHandler()

#Water Costs
#Groundwater
gw_costs = DataHandle.importFiles('WaterSources/data/costs/groundwater', index_col=0, skipinitialspace=True, walk=True)
sw_costs = DataHandle.importFiles('WaterSources/data/costs/surface_water', index_col=0, skipinitialspace=True, walk=True)

#Irrigations
irrigation_data = {}
irrigation_files = DataHandle.importFiles('Irrigations/data', index_col=0, skipinitialspace=True)
irrigation_params = {}

for folder in irrigation_files:

    for irrigation_name in irrigation_files[folder]:

        irrigation_data[irrigation_name] = irrigation_files[folder][irrigation_name]

        temp_data = irrigation_data[irrigation_name]['Best Guess'].to_dict()
        temp_data['irrigation_name'] = irrigation_name
Esempio n. 4
0
    import pandas as pd

    FileHandle = FileHandler()

    #Paths to files
    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
Esempio n. 5
0
    FileHandle = FileHandler()

    #Paths to files
    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]