Commit 5bb47dd1 authored by Woude, Auke van der's avatar Woude, Auke van der
Browse files

Time profiles improved

parent 0b424aba
......@@ -244,7 +244,7 @@ class EmisModel(object):
dum1 = np.fmax(U0_gas - U10[i, :, :], 0) # Wind energy
dum2 = np.fmax(R0_gas - Rinyr[i, :, :], 0) # Solar energy
HDC_gas [i] = dum1 * dum2
HC_cons = HDC_cons.mean(axis=0)
HC_gls = HDC_gls.mean(axis=0)
HC_coal = HDC_coal.mean(axis=0)
......@@ -364,18 +364,18 @@ class EmisModel(object):
t_hdvmr[i, None, None] = hdvmr_mnt[month_idx] * hdvmr_wk[day_idx] * hdvmr_hrd[hour_idx]
t_hdvur[i, None, None] = hdvur_mnt[month_idx] * hdvur_wk[day_idx] * hdvur_hrd[hour_idx]
t_ship [i, None, None] = hdvhw_mnt[month_idx] * hdvhw_wk[day_idx] * hdvhw_hrd[hour_idx]
# --- normalize time profiles
t_gas /= nt
t_coal /= nt
t_cons /= nt
t_gls /= nt
t_carhw /= nt
t_carmr /= nt
t_carur /= nt
t_hdvhw /= nt
t_hdvmr /= nt
t_hdvur /= nt
t_ship /= nt
## --- normalize time profiles
#t_gas /= nt
#t_coal /= nt
#t_cons /= nt
#t_gls /= nt
#t_carhw /= nt
#t_carmr /= nt
#t_carur /= nt
#t_hdvhw /= nt
#t_hdvmr /= nt
#t_hdvur /= nt
#t_ship /= nt
datepoint = self.startdate
enddate = self.enddate
......
energy_use_per_country = {
'AUS': {'Public power': 161.01,
'Industry': 158.02,
'Other stationary combustion': 120.04,
'Road transport': 150.8,
'Shipping': 0.14},
'BEL': {'Public power': 254.82,
'Industry': 203.68,
'Other stationary combustion': 383.16,
'Road transport': 172.455,
'Shipping': 5.63},
'CZE': {'Public power': 582.9,
'Industry': 140.13,
'Other stationary combustion': 178.46,
'Road transport': 121.935,
'Shipping': 0.17},
'FRA': {'Public power': 585.52,
'Industry': 731.9,
'Other stationary combustion': 1262.1,
'Road transport': 845.07,
'Shipping': 20.0},
'DEU': {'Public power': 3515.68,
'Industry': 1516.34,
'Other stationary combustion': 2069.16,
'Road transport': 1066.98,
'Shipping': 26.11},
'LUX': {'Public power': 3.75,
'Industry': 15.23,
'Other stationary combustion': 25.22,
'Road transport': 37.045,
'Shipping': 0.01},
'NED': {'Public power': 868.96,
'Industry': 427.43,
'Other stationary combustion': 599.52,
'Road transport': 199.74,
'Shipping': 13.93},
'POL': {'Public power': 1702.42,
'Industry': 338.92,
'Other stationary combustion': 618.77,
'Road transport': 362.94,
'Shipping': 0.29},
'CHE': {'Public power': 43.41,
'Industry': 66.5,
'Other stationary combustion': 194.77,
'Road transport': 100.28,
'Shipping': 1.54},
'GBR': {'Public power': 1716.77,
'Industry': 620.58,
'Other stationary combustion': 1485.23,
'Road transport': 787.845,
'Shipping': 72.39}}
'AUS': {
'Public power': 161.01,
'Industry': 158.02,
'Other stationary combustion': 120.04,
'Road transport': 150.8,
'Shipping': 0.14
},
'BEL': {
'Public power': 254.82,
'Industry': 203.68,
'Other stationary combustion': 383.16,
'Road transport': 172.455,
'Shipping': 5.63
},
'CZE': {
'Public power': 582.9,
'Industry': 140.13,
'Other stationary combustion': 178.46,
'Road transport': 121.935,
'Shipping': 0.17},
'FRA': {
'Public power': 585.52,
'Industry': 731.9,
'Other stationary combustion': 1262.1,
'Road transport': 845.07,
'Shipping': 20.0
},
'DEU': {
'Public power': 3515.68,
'Industry': 1516.34,
'Other stationary combustion': 2069.16,
'Road transport': 1066.98,
'Shipping': 26.11
},
'LUX': {
'Public power': 3.75,
'Industry': 15.23,
'Other stationary combustion': 25.22,
'Road transport': 37.045,
'Shipping': 0.01
},
'NED': {
'Public power': 868.96,
'Industry': 427.43,
'Other stationary combustion': 599.52,
'Road transport': 199.74,
'Shipping': 13.93
},
'POL': {
'Public power': 1702.42,
'Industry': 338.92,
'Other stationary combustion': 618.77,
'Road transport': 362.94,
'Shipping': 0.29
},
'CHE': {
'Public power': 43.41,
'Industry': 66.5,
'Other stationary combustion': 194.77,
'Road transport': 100.28,
'Shipping': 1.54
},
'GBR': {
'Public power': 1716.77,
'Industry': 620.58,
'Other stationary combustion': 1485.23,
'Road transport': 787.845,
'Shipping': 72.39}}
......@@ -94,18 +94,19 @@ recalc_factors = {'CO2': 1, 'CO': 1000}
spname = ['CO2', 'CO']
def run_STILT(dacycle, footprint, datepoint, species, path, i_member):
def run_STILT(dacycle, footprint, datepoint, species, i_member):
"""This function reads in STILT footprints and returns hourly concentration data
Input:
footprint: np.array: the footprint of the station
datepoint: datepoint: datetime: the datepoint for which the concentrations should be calculated
site : str: name of the location
dacycle : dict: Dictionary containing information on the current time
footprint : np.array: the footprint of the station
datepoint : datetime: the datepoint for which the concentrations should be calculated
species : str: the species
path : path: path to the files containing the emissions
i_member : int: index of the ensemblemember
Returns:
float: the concentration increase at the respective location due to the emissions from the respective species"""
# get the emission data:
spatial_emissions = get_spatial_emissions(dacycle, i_member, species, path, datepoint)
spatial_emissions = get_spatial_emissions(dacycle, i_member, species, datepoint)
# multiply footprint with emissions for each hour in the back trajectory. Indices: Time, Category, lat, lon
foot_flux = (footprint[None, :, :, :] * spatial_emissions[:, :, :, :]).sum()
......@@ -113,11 +114,13 @@ def run_STILT(dacycle, footprint, datepoint, species, path, i_member):
return concentration_increase
@cached
def get_spatial_emissions(dacycle, i_member, species, path, datepoint):
def get_spatial_emissions(dacycle, i_member, species, datepoint):
""" Function that gets the spatial emissions
Input:
dacycle: dict: Dictionary containing information on the current time
i_member: int: the index of the member for which the simulation is run
species: str: the species for which the simulation is run
datepoint: datetime: the date and time of the concentration measurement
Returns:
np.ndarray (3d): the spatial emissions per category, lat and lon"""
#read spatially distributed emissions calculated with the emission model
......@@ -126,6 +129,7 @@ def get_spatial_emissions(dacycle, i_member, species, path, datepoint):
start_time = (dacycle['time.sample.end'] - backtimes)
indices = get_time_indices(datepoint, start_time)
path = dacycle.dasystem['inputdir']
emisfile = path +'prior_spatial_{0:03d}.nc'.format(i_member) #format: species[SNAP, time, lon, lat]
f = io.ct_read(emisfile,method='read')
emis=f.get_variable(species)
......@@ -641,7 +645,7 @@ class STILTObservationOperator(ObservationOperator):
if not 'C14' in species.upper():
pool = Pool(self.forecast_nmembers)
# Create the function that calculates the conentration
func = partial(run_STILT, self.dacycle, self.foot, datepoint, species, self.inputdir)
func = partial(run_STILT, self.dacycle, self.foot, datepoint, species)
# We need to run over all members
memberlist = list(range(0, self.forecast_nmembers))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment