Skip to content
Snippets Groups Projects
Commit a4cf795e authored by Tom Ohlmeyer's avatar Tom Ohlmeyer
Browse files

Nox emission now returns data in kg/km2/y

parent d1cb7463
No related branches found
No related tags found
1 merge request!85GeoPEAS work on original files
Pipeline #191352 failed
...@@ -8,5 +8,5 @@ from utils.agg_serializer import GeneralAggSerializer ...@@ -8,5 +8,5 @@ from utils.agg_serializer import GeneralAggSerializer
class AggSerializer(GeneralAggSerializer): class AggSerializer(GeneralAggSerializer):
def __init__(self, instance): def __init__(self, instance):
instance['unit'] = 'kg m-2 s-1' instance['unit'] = 'kg km-2 y-1'
super(AggSerializer, self).__init__(instance) super(AggSerializer, self).__init__(instance)
...@@ -13,7 +13,8 @@ from utils.g_c_methods import generate_monthly_timestamps, generate_yearly_times ...@@ -13,7 +13,8 @@ from utils.g_c_methods import generate_monthly_timestamps, generate_yearly_times
import xarray as xr import xarray as xr
import nctoolkit as nc import nctoolkit as nc
import rioxarray as rxr import rioxarray as rxr
import os
import time
class GeoCube: class GeoCube:
...@@ -71,6 +72,16 @@ class GeoCube: ...@@ -71,6 +72,16 @@ class GeoCube:
self.dataset = xr.open_dataset( self.dataset = xr.open_dataset(
f"/mnt/geodata/cams_global_emission/CAMS-GLOB-ANT_v4.2_nitrogen-oxides/CAMS-GLOB-ANT_v4.2_nitrogen-oxides_{self.year}.nc", f"/mnt/geodata/cams_global_emission/CAMS-GLOB-ANT_v4.2_nitrogen-oxides/CAMS-GLOB-ANT_v4.2_nitrogen-oxides_{self.year}.nc",
decode_times=False) decode_times=False)
self.dataset = self.dataset["sum"].sel(lon=slice(self.lon - 3, self.lon + 3),
lat=slice(self.lat - 3, self.lat + 3)).to_dataset()
self.dataset.load()
m2_to_km2 = 1e6
s_to_year = 60 * 60 * 24 * 365.25
self.dataset = self.dataset.mean(dim="time")
self.dataset = self.dataset * m2_to_km2 * s_to_year
self.xarray = True self.xarray = True
lat = self.dataset["lat"][:] lat = self.dataset["lat"][:]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment