def runBaklidammen(startDate, endDate): LocationNames = ["Baklidammen 200 moh"] x = 266550 y = 7040812 from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") cs_temp = gcsd.getGriddata(x, y, "tm", from_date, to_date) cs_sno = gcsd.getGriddata(x, y, "fsw", from_date, to_date) cs_snotot = gcsd.getGriddata(x, y, "sd", from_date, to_date) wsCC = gws.getMetData(68860, "NNM", startDate, endDate, 0, "list") # TRONDHEIM - VOLL temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationNames, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = "{0}Baklidammen {1}-{2}.png".format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runStorvannetHammerfest(startDate, endDate): LocationNames = ["Storvannet, 7 moh"] x = 821340 y = 7862497 from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") cs_temp = gcsd.getGriddata(x, y, "tm", from_date, to_date) cs_sno = gcsd.getGriddata(x, y, "fsw", from_date, to_date) cs_snotot = gcsd.getGriddata(x, y, "sd", from_date, to_date) wsCC = gws.getMetData(95350, "NNM", startDate, endDate, 0, "list") # BANAK - østover innerst i fjorden temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationNames, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = "{0}StorvannetHammerfest {1}-{2}.png".format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runSkoddebergvatnet(startDate, endDate): LocationName = "Skoddebergvatnet - nord 101 moh" # Skoddebergvatnet - sør 101 moh from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") # cs_temp = gcsd.getGriddata('189.3.0','17.1', from_date, to_date) cs_temp = gcsd.getGriddata(593273, 7612469, "tm", from_date, to_date) cs_sno = gcsd.getGriddata(593273, 7612469, "fsw", from_date, to_date) cs_snotot = gcsd.getGriddata(593273, 7612469, "sd", from_date, to_date) wsCC = gws.getMetData(87640, "NNM", startDate, endDate, 0, "list") # Harstad Stadion temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationName, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = "{0}Skoddebergvatnet {1}-{2}.png".format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runGiljastolsvatnet(startDate, endDate): LocationNames = ["Giljastølsvatnet 412 moh", "Giljastølvatnet sør 412 moh"] x = -1904 y = 6553573 from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") # cs_temp = gcsd.getStationdata('189.3.0','17.1', from_date, to_date) cs_temp = gcsd.getGriddata(x, y, "tm", from_date, to_date) cs_sno = gcsd.getGriddata(x, y, "fsw", from_date, to_date) cs_snotot = gcsd.getGriddata(x, y, "sd", from_date, to_date) wsCC = gws.getMetData( 43010, "NNM", startDate, endDate, 0, "list" ) # Eik - Hove. Ligger lenger sør men er litt inn i landet. # wsCC = getMetData(43010, 'NNM', startDate, endDate, 0, 'list') # Sola (44560) er et alternativ temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationNames, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = "{0}Giljastolsvatnet {1}-{2}.png".format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runStorvannetHammerfest(startDate, endDate): LocationNames = ['Storvannet, 7 moh'] x = 821340 y = 7862497 from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") cs_temp = gcsd.getGriddata(x, y, 'tm', from_date, to_date) cs_sno = gcsd.getGriddata(x, y, 'fsw', from_date, to_date) cs_snotot = gcsd.getGriddata(x, y, 'sd', from_date, to_date) wsCC = gws.getMetData(95350, 'NNM', startDate, endDate, 0, 'list') # BANAK - østover innerst i fjorden temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationNames, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = '{0}StorvannetHammerfest {1}-{2}.png'.format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runHakkloa(startDate, endDate): LocationName = "Hakkloa nord 372 moh" from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") cs_temp = gcsd.getStationdata("6.24.4", "17.1", from_date, to_date, timeseries_type=0) cs_sno = gcsd.getGriddata(260150, 6671135, "fsw", from_date, to_date, timeseries_type=0) cs_snotot = gcsd.getGriddata(260150, 6671135, "sd", from_date, to_date, timeseries_type=0) wsCC = gws.getMetData(18700, "NNM", startDate, endDate, 0, "list") temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationName, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = "{0}Hakkloa {1}-{2}.png".format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runBaklidammen(startDate, endDate): LocationNames = ['Baklidammen 200 moh'] x = 266550 y = 7040812 from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") cs_temp = gcsd.getGriddata(x, y, 'tm', from_date, to_date) cs_sno = gcsd.getGriddata(x, y, 'fsw', from_date, to_date) cs_snotot = gcsd.getGriddata(x, y, 'sd', from_date, to_date) wsCC = gws.getMetData(68860, 'NNM', startDate, endDate, 0, 'list') # TRONDHEIM - VOLL temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationNames, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = '{0}Baklidammen {1}-{2}.png'.format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runGiljastolsvatnet(startDate, endDate): LocationNames = ['Giljastølsvatnet 412 moh', 'Giljastølvatnet sør 412 moh'] x = -1904 y = 6553573 from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") #cs_temp = gcsd.getStationdata('189.3.0','17.1', from_date, to_date) cs_temp = gcsd.getGriddata(x, y, 'tm', from_date, to_date) cs_sno = gcsd.getGriddata(x, y, 'fsw', from_date, to_date) cs_snotot = gcsd.getGriddata(x, y, 'sd', from_date, to_date) wsCC = gws.getMetData(43010, 'NNM', startDate, endDate, 0, 'list') # Eik - Hove. Ligger lenger sør men er litt inn i landet. #wsCC = getMetData(43010, 'NNM', startDate, endDate, 0, 'list') # Sola (44560) er et alternativ temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationNames, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = '{0}Giljastolsvatnet {1}-{2}.png'.format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runSkoddebergvatnet(startDate, endDate): LocationName = 'Skoddebergvatnet - nord 101 moh' # Skoddebergvatnet - sør 101 moh from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") #cs_temp = gcsd.getGriddata('189.3.0','17.1', from_date, to_date) cs_temp = gcsd.getGriddata(593273, 7612469, 'tm', from_date, to_date) cs_sno = gcsd.getGriddata(593273, 7612469, 'fsw', from_date, to_date) cs_snotot = gcsd.getGriddata(593273, 7612469, 'sd', from_date, to_date) wsCC = gws.getMetData(87640, 'NNM', startDate, endDate, 0, 'list') # Harstad Stadion temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationName, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = '{0}Skoddebergvatnet {1}-{2}.png'.format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def runHakkloa(startDate, endDate): LocationName = 'Hakkloa nord 372 moh' from_date = dt.datetime.strptime(startDate, "%Y-%m-%d") to_date = dt.datetime.strptime(endDate, "%Y-%m-%d") cs_temp = gcsd.getStationdata('6.24.4','17.1', from_date, to_date, timeseries_type=0) cs_sno = gcsd.getGriddata(260150, 6671135, 'fsw', from_date, to_date, timeseries_type=0) cs_snotot = gcsd.getGriddata(260150, 6671135, 'sd', from_date, to_date, timeseries_type=0) wsCC = gws.getMetData(18700, 'NNM', startDate, endDate, 0, 'list') temp, date = we.strip_metadata(cs_temp, True) sno = we.strip_metadata(cs_sno, False) snotot = we.strip_metadata(cs_snotot, False) cc = we.strip_metadata(wsCC, False) observed_ice = gro.get_all_season_ice(LocationName, startDate, endDate) if len(observed_ice) == 0: ice_cover = calculate_ice_cover_air_temp(ice.IceColumn(date[0], []), date, temp, sno, cc) else: ice_cover = calculate_ice_cover_air_temp(copy.deepcopy(observed_ice[0]), date, temp, sno, cc) plot_filename = '{0}Hakkloa {1}-{2}.png'.format(plot_folder, startDate[0:4], endDate[0:4]) pts.plot_ice_cover(ice_cover, observed_ice, date, temp, snotot, plot_filename)
def harvest_for_mylake_hakkloa(from_string, to_string): """Method gathers meteorological parameters needed to run myLake on Hakkloa and saves them to a formatted file as needed to run myLake. For columns needed se MyLakeInput class. :param from_string: {string} from date to acquire data :param to_string: {string} to date to acquire data :return: HydraII parameters: Wind 15 Temperature 17 Relative humidity 2 """ utm33_x = 259942 # Hakloa (buoy) utm33_y = 6671218 # Hakloa (buoy) stnr_met_blind = 18700 # Blindern (met) stnr_met_bjorn = 18500 # Bjørnholt (met) stnr_nve = '6.24.4' # Hakloa (NVE) hydraii_temperature = '{0}6.24.4.17.1 Hakkloa temperatur 20110101-20151009.txt'.format(env.data_path) hydraii_wind = '{0}6.24.4.15.1 Hakkloa vind 20110101-20151009.txt'.format(env.data_path) hydraii_relative_humidity = '{0}6.24.4.2.1 Hakkloa relativ fuktighet 20110101-20151009.txt'.format(env.data_path) from_date = dt.datetime.strptime(from_string, "%Y-%m-%d") to_date = dt.datetime.strptime(to_string, "%Y-%m-%d") data = MyLakeInput(from_date, to_date) data.output_file_path = '{0}HAK_input'.format(env.data_path) data.output_header = 'MyLake model input data for Hakkloa from Hakkloa (NVE), Bjørnholt (met) and Blindern (met) stations' data.add_Global_rad(we.constant_weather_element('Hakkloa', from_date, to_date, 'Global_rad', None)) data.add_Cloud_cov(gws.getMetData(stnr_met_blind, 'NNM', from_date, to_date, 0)) data.add_Air_temp(gfd.read_hydra_time_value(stnr_nve, '17.1', hydraii_temperature, from_date, to_date)) data.add_Relat_hum(gfd.read_hydra_time_value(stnr_nve, '2.1', hydraii_relative_humidity, from_date, to_date)) data.add_Air_press(gws.getMetData(stnr_met_blind, 'POM', from_date, to_date, 0)) data.add_Wind_speed(gfd.read_hydra_time_value(stnr_nve, '15.1', hydraii_wind, from_date, to_date)) data.add_Precipitation(we.millimeter_from_meter(gws.getMetData(stnr_met_bjorn, 'RR', from_date, to_date, 0))) # Inflow is water shed area * precipitation Inflow = [] precipitation = data.Precipitation # precipitation in [mm] water_shed_area = 6.49 * 10**6 # [m2] for p in precipitation: value = p.Value/1000*water_shed_area Inflow.append(we.WeatherElement('Hakkloa', p.Date, 'Inflow', value)) data.add_Inflow(Inflow) # Inflow temperature is assumed air temp but never below 0C and if snow always 0C snow = gcs.getGriddata(utm33_x, utm33_y, 'sd', from_date, to_date) temperature = data.Air_temp #mfd.write_weather_element_list(temperature) #mfd.write_weather_element_list(snow) #mfd.write_weather_element_list(data.Relat_hum) #mfd.write_weather_element_list(data.Wind_speed) Inflow_T = [] for i in range(0, len(snow), 1): date = temperature[i].Date value = max(0., temperature[i].Value) # water never below 0C if snow[i].Value > 0. and value > 0.: # if snow, water never over 0C value = 0. Inflow_T.append(we.WeatherElement('Hakkloa', date, 'Inflow_T', value)) data.add_Inflow_T(Inflow_T) data.add_Inflow_C(we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_C', .5)) data.add_Inflow_S(we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_S', .01)) data.add_Inflow_TP(we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_TP', 44.)) data.add_Inflow_DOP(we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_DOP', 7.)) data.add_Inflow_Chla(we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_Chla', .1)) data.add_Inflow_DOC(we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_DOC', 3000.)) return data
def harvest_for_mylake_hakkloa(from_string, to_string): """Method gathers meteorological parameters needed to run myLake on Hakkloa and saves them to a formatted file as needed to run myLake. For columns needed se MyLakeInput class. :param from_string: {string} from date to acquire data :param to_string: {string} to date to acquire data :return: HydraII parameters: Wind 15 Temperature 17 Relative humidity 2 """ utm33_x = 259942 # Hakloa (buoy) utm33_y = 6671218 # Hakloa (buoy) stnr_met_blind = 18700 # Blindern (met) stnr_met_bjorn = 18500 # Bjørnholt (met) stnr_nve = '6.24.4' # Hakloa (NVE) hydraii_temperature = '{0}6.24.4.17.1 Hakkloa temperatur 20110101-20151009.txt'.format( env.data_path) hydraii_wind = '{0}6.24.4.15.1 Hakkloa vind 20110101-20151009.txt'.format( env.data_path) hydraii_relative_humidity = '{0}6.24.4.2.1 Hakkloa relativ fuktighet 20110101-20151009.txt'.format( env.data_path) from_date = dt.datetime.strptime(from_string, "%Y-%m-%d") to_date = dt.datetime.strptime(to_string, "%Y-%m-%d") data = MyLakeInput(from_date, to_date) data.output_file_path = '{0}HAK_input'.format(env.data_path) data.output_header = 'MyLake model input data for Hakkloa from Hakkloa (NVE), Bjørnholt (met) and Blindern (met) stations' data.add_Global_rad( we.constant_weather_element('Hakkloa', from_date, to_date, 'Global_rad', None)) data.add_Cloud_cov( gws.getMetData(stnr_met_blind, 'NNM', from_date, to_date, 0)) data.add_Air_temp( gfd.read_hydra_time_value(stnr_nve, '17.1', hydraii_temperature, from_date, to_date)) data.add_Relat_hum( gfd.read_hydra_time_value(stnr_nve, '2.1', hydraii_relative_humidity, from_date, to_date)) data.add_Air_press( gws.getMetData(stnr_met_blind, 'POM', from_date, to_date, 0)) data.add_Wind_speed( gfd.read_hydra_time_value(stnr_nve, '15.1', hydraii_wind, from_date, to_date)) data.add_Precipitation( we.millimeter_from_meter( gws.getMetData(stnr_met_bjorn, 'RR', from_date, to_date, 0))) # Inflow is water shed area * precipitation Inflow = [] precipitation = data.Precipitation # precipitation in [mm] water_shed_area = 6.49 * 10**6 # [m2] for p in precipitation: value = p.Value / 1000 * water_shed_area Inflow.append(we.WeatherElement('Hakkloa', p.Date, 'Inflow', value)) data.add_Inflow(Inflow) # Inflow temperature is assumed air temp but never below 0C and if snow always 0C snow = gcs.getGriddata(utm33_x, utm33_y, 'sd', from_date, to_date) temperature = data.Air_temp #mfd.write_weather_element_list(temperature) #mfd.write_weather_element_list(snow) #mfd.write_weather_element_list(data.Relat_hum) #mfd.write_weather_element_list(data.Wind_speed) Inflow_T = [] for i in range(0, len(snow), 1): date = temperature[i].Date value = max(0., temperature[i].Value) # water never below 0C if snow[i].Value > 0. and value > 0.: # if snow, water never over 0C value = 0. Inflow_T.append(we.WeatherElement('Hakkloa', date, 'Inflow_T', value)) data.add_Inflow_T(Inflow_T) data.add_Inflow_C( we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_C', .5)) data.add_Inflow_S( we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_S', .01)) data.add_Inflow_TP( we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_TP', 44.)) data.add_Inflow_DOP( we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_DOP', 7.)) data.add_Inflow_Chla( we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_Chla', .1)) data.add_Inflow_DOC( we.constant_weather_element('Hakkloa', from_date, to_date, 'Inflow_DOC', 3000.)) return data