Skip to content
Snippets Groups Projects
Commit 59c95f01 authored by Paul Gierz's avatar Paul Gierz
Browse files

fix(gfw_creator): applies unit conversions to file, assumes user gives Sv

Applies unit transformation to the gfw_atmo.nc file that is generated, assuming that the user gave an input value in Sverdrup.
parent b43fa42b
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,6 @@
"""Main module."""
import cdo
import numpy as np
import xarray as xr
import os
......@@ -60,6 +59,9 @@ def create_homogeneous_hosing(lat_0, lat_1, lon_0, lon_1, hosing_strength):
Creates a homogeneous hosing field
"""
ds = _get_template_file()
# hosing strength is given in Sv. Convert this to m3/s
# 1 Sv = 10**6 m3/s
hosing_strength /= 1.e6
hosing_per_area = hosing_strength / _lat_lon_area(lat_0, lat_1, lon_0, lon_1)
gfw_atmo_file = CDO.setclonlatbox(f"{hosing_per_area},{lon_0},{lon_1},{lat_0},{lat_1}", input=ds, returnXDataset=True)
return gfw_atmo_file
......@@ -11,7 +11,7 @@ with open('README.rst') as readme_file:
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['Click>=6.0', ]
requirements = ['Click>=6.0', "xarray"]
setup_requirements = ['pytest-runner', ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment