Open
Description
Bug summary
The hourofyear
NetCDF needs to have a fixed size of 8784 hours; which isn't the case currently (maybe it is for a leap year, but not for my tested year 2018).
Code for reproduction
from emiproc.inventories.tno import TNO_Inventory
inv = TNO_Inventory("/users/ekoene/CTDAS_inputs/TNO_6x6_GHGco_v4_0/TNO_GHGco_v4_0_year2018.nc")
from emiproc.grids import ICONGrid
icon_grid_file = "/users/ekoene/CTDAS_inputs/icon_europe_DOM01.nc"
icon_grid = ICONGrid(icon_grid_file)
# Convert to a planar crs before
# you will get a warning from pygeos if you dont do that
from emiproc.grids import WGS84_PROJECTED
inv.to_crs(WGS84_PROJECTED)
from emiproc.regrid import remap_inventory
remaped_tno = remap_inventory(inv, icon_grid, ".remap_tno5")
from emiproc.exports.icon import export_icon_oem, TemporalProfilesTypes
export_icon_oem(remaped_tno,
icon_grid_file,
"/capstor/scratch/cscs/ekoene/inventories/icon_with_tno_emissions/",
temporal_profiles_type=TemporalProfilesTypes.HOUR_OF_YEAR,
year=2018,
substances='CO2')
Additional information
Currently, in ICON-ART-OEM, the following things are hardcoded:
INTEGER, PARAMETER :: tp_param_hour = 8784
<...>
ierror = nf90_get_var(hyid, varid, oem_data%tp_hourofyear(:,i,:), &
start = (/1,1/), count=(/oem_config%tp_ncountry,tp_param_hour/), &
map = (/ tp_param_hour, 1 /))
in other words, it tries to read out a table from (1,1) to (n_countries, 8784) from the NetCDF. However, emiproc only writes out a table of size (1,1) to (n_countries, 8760) for the TNO database for the year 2018. Hence, the NetCDF reading runs into an error as there isn't enough data present, and ICON crashes correspondingly.
I manually simply appended a copy of the final day into the NetCDF as a workaround for my case, but it'd be good if this could be addressed in emiproc in some way.
Metadata
Metadata
Assignees
Labels
No labels