From 32e675f6aa991d2f675964bb4b41280596b57e76 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Thu, 22 Aug 2024 10:33:25 -0400 Subject: [PATCH 1/5] Changes to test_eta.py to support changes in PR 65 in NDSL --- tests/main/grid/test_eta.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/main/grid/test_eta.py b/tests/main/grid/test_eta.py index f21c8896..56b9068c 100755 --- a/tests/main/grid/test_eta.py +++ b/tests/main/grid/test_eta.py @@ -106,14 +106,14 @@ def test_set_hybrid_pressure_coefficients_nofile(): with open(config_file, "r") as f: yaml_config = yaml.safe_load(f) - del yaml_config["grid_config"]["config"]["eta_file"] + yaml_config["grid_config"]["config"]["eta_file"] = "" try: driver_config = DriverConfig.from_dict(yaml_config) driver_config.comm_config = NullCommConfig(rank=0, total_ranks=6) driver = Driver(config=driver_config) except Exception as error: - if str(error) == "eta file not specified": + if str(error) == "eta file does not exist": pytest.xfail("testing eta file not specified") else: pytest.fail(f"ERROR {error}") From 6a538054544b7dc93d0c8520feb5bb0c392a5e90 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Tue, 27 Aug 2024 13:19:44 -0400 Subject: [PATCH 2/5] Removed test_eta.py, moved to NDSL/tests/grid --- tests/main/grid/test_eta.py | 156 ------------------------------------ 1 file changed, 156 deletions(-) delete mode 100755 tests/main/grid/test_eta.py diff --git a/tests/main/grid/test_eta.py b/tests/main/grid/test_eta.py deleted file mode 100755 index 56b9068c..00000000 --- a/tests/main/grid/test_eta.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python3 - -import os - -import numpy as np -import pytest -import xarray as xr -import yaml - -from pace import Driver, DriverConfig, NullCommConfig - - -""" -This test checks to ensure that ak and bk -values are read-in and stored properly. -In addition, this test checks to ensure that -the function set_hybrid_pressure_coefficients -fail as expected if the computed eta values -vary non-mononitically and if the eta_file -is not provided. -""" - - -def set_answers(eta_file): - - """ - Read in the expected values of ak and bk - arrays from the input eta NetCDF files. - """ - - data = xr.open_dataset(eta_file) - return data["ak"].values, data["bk"].values - - -def write_non_mono_eta_file(in_eta_file, out_eta_file): - """ - Reads in file eta79.nc and alters randomly chosen ak/bk values - This tests the expected failure of set_eta_hybrid_coefficients - for coefficients that lead to non-monotonically increasing - eta values - """ - - data = xr.open_dataset(in_eta_file) - data["ak"].values[10] = data["ak"].values[0] - data["bk"].values[20] = 0.0 - - data.to_netcdf(out_eta_file) - - -@pytest.mark.parametrize("km", [79, 91]) -def test_set_hybrid_pressure_coefficients_correct(km): - - """This test checks to see that the ak and bk arrays - are read-in correctly and are stored as - expected. Both values of km=79 and km=91 are - tested and both tests are expected to pass - with the stored ak and bk values agreeing with the - values read-in directly from the NetCDF file. - """ - - dirname = os.path.dirname(os.path.abspath(__file__)) - config_file = os.path.join(dirname, "../../../examples/configs/baroclinic_c12.yaml") - - with open(config_file, "r") as f: - yaml_config = yaml.safe_load(f) - - yaml_config["nz"] = km - yaml_config["grid_config"]["config"]["eta_file"] = f"tests/main/input/eta{km}.nc" - - driver_config = DriverConfig.from_dict(yaml_config) - driver_config.comm_config = NullCommConfig(rank=0, total_ranks=6) - driver = Driver(config=driver_config) - - p_results = driver.state.grid_data.p.data - ak_results = driver.state.grid_data.ak.data - bk_results = driver.state.grid_data.bk.data - ak_answers, bk_answers = set_answers(f"tests/main/input/eta{km}.nc") - - if ak_answers.size != ak_results.size: - raise ValueError("Unexpected size of bk") - if bk_answers.size != bk_results.size: - raise ValueError("Unexpected size of ak") - - if not np.array_equal(ak_answers, ak_results): - raise ValueError("Unexpected value of ak") - if not np.array_equal(bk_answers, bk_results): - raise ValueError("Unexpected value of bk") - - driver.safety_checker.clear_all_checks() - - -def test_set_hybrid_pressure_coefficients_nofile(): - - """This test checks to see that the program - fails when (1) the eta_file is not specified in the yaml - configuration file; and (2), the computed eta values - increase non-monotonically. For the latter test, the eta_file - is specified in test_config_not_mono.yaml file and - the ak and bk values in the eta_file have been changed nonsensically - to result in erronenous eta values. - """ - - dirname = os.path.dirname(os.path.abspath(__file__)) - config_file = os.path.join(dirname, "../../../examples/configs/baroclinic_c12.yaml") - - with open(config_file, "r") as f: - yaml_config = yaml.safe_load(f) - - yaml_config["grid_config"]["config"]["eta_file"] = "" - - try: - driver_config = DriverConfig.from_dict(yaml_config) - driver_config.comm_config = NullCommConfig(rank=0, total_ranks=6) - driver = Driver(config=driver_config) - except Exception as error: - if str(error) == "eta file does not exist": - pytest.xfail("testing eta file not specified") - else: - pytest.fail(f"ERROR {error}") - - -def test_set_hybrid_pressure_coefficients_not_mono(): - - """This test checks to see that the program - fails when (1) the eta_file is not specified in the yaml - configuration file; and (2), the computed eta values - increase non-monotonically. For the latter test, the eta_file - is specified in test_config_not_mono.yaml file and - the ak and bk values in the eta_file have been changed nonsensically - to result in erronenous eta values. - """ - - dirname = os.path.dirname(os.path.abspath(__file__)) - config_file = os.path.join(dirname, "../../../examples/configs/baroclinic_c12.yaml") - - with open(config_file, "r") as f: - yaml_config = yaml.safe_load(f) - - in_eta_file = "tests/main/input/eta79.nc" - out_eta_file = "eta_not_mono_79.nc" - write_non_mono_eta_file(in_eta_file, out_eta_file) - yaml_config["grid_config"]["config"]["eta_file"] = out_eta_file - - try: - driver_config = DriverConfig.from_dict(yaml_config) - driver_config.comm_config = NullCommConfig(rank=0, total_ranks=6) - driver = Driver(config=driver_config) - except Exception as error: - if os.path.isfile(out_eta_file): - os.remove(out_eta_file) - if str(error) == "ETA values are not monotonically increasing": - pytest.xfail("testing eta values are not monotomincally increasing") - else: - pytest.fail( - "ERROR in testing etav values not are not monotonically increasing" - ) From 9ffcdf487b20b844688dfb4618cd7ecd27316f13 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Tue, 27 Aug 2024 14:19:10 -0400 Subject: [PATCH 3/5] Moved over eta_file generator script to NDSL/tests/grid --- examples/generate_eta_files.py | 399 --------------------------------- 1 file changed, 399 deletions(-) delete mode 100755 examples/generate_eta_files.py diff --git a/examples/generate_eta_files.py b/examples/generate_eta_files.py deleted file mode 100755 index 1fb4d5ee..00000000 --- a/examples/generate_eta_files.py +++ /dev/null @@ -1,399 +0,0 @@ -import numpy as np -import xarray as xr - - -""" -This notebook uses the python xarray module -to create an eta_file containing ak and bk coefficients -for km=79 and km=91. The coefficients are written out to -eta79.nc and eta91.nc netcdf files respectively - -To run this script: `python3 ./generate_eta_files.py` -""" - -# km = 79 -ak = xr.DataArray( - dims=["km1"], - attrs=dict(units="Pa", _FillValue=False), - data=np.array( - [ - 3.000000e02, - 6.467159e02, - 1.045222e03, - 1.469188e03, - 1.897829e03, - 2.325385e03, - 2.754396e03, - 3.191294e03, - 3.648332e03, - 4.135675e03, - 4.668282e03, - 5.247940e03, - 5.876271e03, - 6.554716e03, - 7.284521e03, - 8.066738e03, - 8.902188e03, - 9.791482e03, - 1.073499e04, - 1.162625e04, - 1.237212e04, - 1.299041e04, - 1.349629e04, - 1.390277e04, - 1.422098e04, - 1.446058e04, - 1.462993e04, - 1.473633e04, - 1.478617e04, - 1.478511e04, - 1.473812e04, - 1.464966e04, - 1.452370e04, - 1.436382e04, - 1.417324e04, - 1.395491e04, - 1.371148e04, - 1.344540e04, - 1.315890e04, - 1.285407e04, - 1.253280e04, - 1.219685e04, - 1.184788e04, - 1.148739e04, - 1.111682e04, - 1.073748e04, - 1.035062e04, - 9.957395e03, - 9.558875e03, - 9.156069e03, - 8.749922e03, - 8.341315e03, - 7.931065e03, - 7.519942e03, - 7.108648e03, - 6.698281e03, - 6.290007e03, - 5.884984e03, - 5.484372e03, - 5.089319e03, - 4.700960e03, - 4.320421e03, - 3.948807e03, - 3.587201e03, - 3.236666e03, - 2.898237e03, - 2.572912e03, - 2.261667e03, - 1.965424e03, - 1.685079e03, - 1.421479e03, - 1.175419e03, - 9.476516e02, - 7.388688e02, - 5.497130e02, - 3.807626e02, - 2.325417e02, - 1.054810e02, - -8.381903e-04, - 0.000000e00, - ] - ), -) -bk = xr.DataArray( - dims=["km1"], - attrs=dict(units="None", _FillValue=False), - data=np.array( - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.00106595, - 0.00412866, - 0.00900663, - 0.01554263, - 0.02359921, - 0.03305481, - 0.0438012, - 0.05574095, - 0.06878554, - 0.08285347, - 0.09786981, - 0.1137643, - 0.130471, - 0.1479275, - 0.1660746, - 0.1848558, - 0.2042166, - 0.2241053, - 0.2444716, - 0.2652672, - 0.286445, - 0.3079604, - 0.3297701, - 0.351832, - 0.3741062, - 0.3965532, - 0.4191364, - 0.4418194, - 0.4645682, - 0.48735, - 0.5101338, - 0.5328897, - 0.5555894, - 0.5782067, - 0.6007158, - 0.6230936, - 0.6452944, - 0.6672683, - 0.6889648, - 0.7103333, - 0.7313231, - 0.7518838, - 0.7719651, - 0.7915173, - 0.8104913, - 0.828839, - 0.846513, - 0.8634676, - 0.8796583, - 0.8950421, - 0.9095779, - 0.9232264, - 0.9359506, - 0.9477157, - 0.9584892, - 0.9682413, - 0.9769447, - 0.9845753, - 0.9911126, - 0.9965372, - 1.0, - ] - ), -) -coefficients = xr.Dataset(data_vars={"ak": ak, "bk": bk}) -coefficients.to_netcdf("eta79.nc") - - -# km = 91 -ak = xr.DataArray( - dims=["km1"], - attrs=dict(units="Pa", _FillValue=False), - data=np.array( - [ - 1.00000000e00, - 1.75000000e00, - 2.75000000e00, - 4.09999990e00, - 5.98951054e00, - 8.62932968e00, - 1.22572632e01, - 1.71510906e01, - 2.36545467e01, - 3.21627693e01, - 4.31310921e01, - 5.71100426e01, - 7.46595764e01, - 9.64470978e01, - 1.23169769e02, - 1.55601318e02, - 1.94594009e02, - 2.41047531e02, - 2.95873840e02, - 3.60046967e02, - 4.34604828e02, - 5.20628723e02, - 6.19154846e02, - 7.31296021e02, - 8.58240906e02, - 1.00106561e03, - 1.16092859e03, - 1.33903992e03, - 1.53650012e03, - 1.75448938e03, - 1.99417834e03, - 2.25667407e03, - 2.54317139e03, - 2.85476392e03, - 3.19258569e03, - 3.55775366e03, - 3.95135107e03, - 4.37428662e03, - 4.82711084e03, - 5.31022168e03, - 5.82387793e03, - 6.36904248e03, - 6.94875244e03, - 7.56691992e03, - 8.22634277e03, - 8.93120996e03, - 9.68446191e03, - 1.04822725e04, - 1.13182793e04, - 1.21840771e04, - 1.30655674e04, - 1.39532207e04, - 1.48307285e04, - 1.56872617e04, - 1.65080645e04, - 1.72810996e04, - 1.79942988e04, - 1.86363223e04, - 1.91961797e04, - 1.96640723e04, - 2.00301914e04, - 2.02853691e04, - 2.04215254e04, - 2.04300684e04, - 2.03028730e04, - 2.00323711e04, - 1.96110664e04, - 1.90313848e04, - 1.82866426e04, - 1.73777930e04, - 1.63224639e04, - 1.51444033e04, - 1.38725674e04, - 1.25404785e04, - 1.11834170e04, - 9.83532715e03, - 8.52630664e03, - 7.28224512e03, - 6.12326074e03, - 5.06350684e03, - 4.11124902e03, - 3.27000122e03, - 2.53922729e03, - 1.91530762e03, - 1.39244995e03, - 9.63134766e02, - 6.20599365e02, - 3.57989502e02, - 1.69421387e02, - 5.10314941e01, - 2.48413086e00, - 0.00000000e00, - ] - ), -) -bk = xr.DataArray( - dims=["km1"], - attrs=dict(units="None", _FillValue=False), - data=np.array( - [ - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 0.00000000e00, - 3.50123992e-06, - 2.81484008e-05, - 9.38666999e-05, - 2.28561999e-04, - 5.12343016e-04, - 1.04712998e-03, - 1.95625005e-03, - 3.42317997e-03, - 5.58632007e-03, - 8.65428988e-03, - 1.27844000e-02, - 1.81719996e-02, - 2.49934997e-02, - 3.34198996e-02, - 4.36249003e-02, - 5.57769015e-02, - 7.00351968e-02, - 8.65636021e-02, - 1.05520003e-01, - 1.27051994e-01, - 1.51319996e-01, - 1.78477004e-01, - 2.08675995e-01, - 2.42069006e-01, - 2.78813988e-01, - 3.19043010e-01, - 3.62558991e-01, - 4.08596009e-01, - 4.56384987e-01, - 5.05111992e-01, - 5.53902984e-01, - 6.01903021e-01, - 6.48333013e-01, - 6.92534983e-01, - 7.33981013e-01, - 7.72292018e-01, - 8.07236016e-01, - 8.38724971e-01, - 8.66774976e-01, - 8.91497016e-01, - 9.13065016e-01, - 9.31702971e-01, - 9.47658002e-01, - 9.61175978e-01, - 9.72495019e-01, - 9.81844008e-01, - 9.89410996e-01, - 9.95342016e-01, - 1.00000000e00, - ] - ), -) -coefficients = xr.Dataset(data_vars={"ak": ak, "bk": bk}) -coefficients.to_netcdf("eta91.nc") - -# km = From 1f5579ef67d78ad5e9cfc9a20f1f69a864128941 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Tue, 27 Aug 2024 14:29:02 -0400 Subject: [PATCH 4/5] Amending workflow to reflect removal of eta file generator script --- .github/workflows/main_unit_tests.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/main_unit_tests.yaml b/.github/workflows/main_unit_tests.yaml index f5f6739b..4bdd95c6 100644 --- a/.github/workflows/main_unit_tests.yaml +++ b/.github/workflows/main_unit_tests.yaml @@ -48,13 +48,6 @@ jobs: pip3 install --upgrade pip setuptools wheel pip3 install -r requirements_dev.txt -c constraints.txt - - name: prepare input files - run: | - cd ${GITHUB_WORKSPACE}/pace - mkdir tests/main/input - python3 examples/generate_eta_files.py - mv *eta*.nc tests/main/input - - name: run tests run: | cd ${GITHUB_WORKSPACE}/pace From 7fc42cfbdba2b83522076b08a4ba9301e366d2b3 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Tue, 27 Aug 2024 14:37:40 -0400 Subject: [PATCH 5/5] Adding back in generate_eta_files.py as it is needed for other tests, adding file generation call to workflow --- .github/workflows/main_unit_tests.yaml | 7 + examples/generate_eta_files.py | 399 +++++++++++++++++++++++++ 2 files changed, 406 insertions(+) create mode 100755 examples/generate_eta_files.py diff --git a/.github/workflows/main_unit_tests.yaml b/.github/workflows/main_unit_tests.yaml index 4bdd95c6..f5f6739b 100644 --- a/.github/workflows/main_unit_tests.yaml +++ b/.github/workflows/main_unit_tests.yaml @@ -48,6 +48,13 @@ jobs: pip3 install --upgrade pip setuptools wheel pip3 install -r requirements_dev.txt -c constraints.txt + - name: prepare input files + run: | + cd ${GITHUB_WORKSPACE}/pace + mkdir tests/main/input + python3 examples/generate_eta_files.py + mv *eta*.nc tests/main/input + - name: run tests run: | cd ${GITHUB_WORKSPACE}/pace diff --git a/examples/generate_eta_files.py b/examples/generate_eta_files.py new file mode 100755 index 00000000..1fb4d5ee --- /dev/null +++ b/examples/generate_eta_files.py @@ -0,0 +1,399 @@ +import numpy as np +import xarray as xr + + +""" +This notebook uses the python xarray module +to create an eta_file containing ak and bk coefficients +for km=79 and km=91. The coefficients are written out to +eta79.nc and eta91.nc netcdf files respectively + +To run this script: `python3 ./generate_eta_files.py` +""" + +# km = 79 +ak = xr.DataArray( + dims=["km1"], + attrs=dict(units="Pa", _FillValue=False), + data=np.array( + [ + 3.000000e02, + 6.467159e02, + 1.045222e03, + 1.469188e03, + 1.897829e03, + 2.325385e03, + 2.754396e03, + 3.191294e03, + 3.648332e03, + 4.135675e03, + 4.668282e03, + 5.247940e03, + 5.876271e03, + 6.554716e03, + 7.284521e03, + 8.066738e03, + 8.902188e03, + 9.791482e03, + 1.073499e04, + 1.162625e04, + 1.237212e04, + 1.299041e04, + 1.349629e04, + 1.390277e04, + 1.422098e04, + 1.446058e04, + 1.462993e04, + 1.473633e04, + 1.478617e04, + 1.478511e04, + 1.473812e04, + 1.464966e04, + 1.452370e04, + 1.436382e04, + 1.417324e04, + 1.395491e04, + 1.371148e04, + 1.344540e04, + 1.315890e04, + 1.285407e04, + 1.253280e04, + 1.219685e04, + 1.184788e04, + 1.148739e04, + 1.111682e04, + 1.073748e04, + 1.035062e04, + 9.957395e03, + 9.558875e03, + 9.156069e03, + 8.749922e03, + 8.341315e03, + 7.931065e03, + 7.519942e03, + 7.108648e03, + 6.698281e03, + 6.290007e03, + 5.884984e03, + 5.484372e03, + 5.089319e03, + 4.700960e03, + 4.320421e03, + 3.948807e03, + 3.587201e03, + 3.236666e03, + 2.898237e03, + 2.572912e03, + 2.261667e03, + 1.965424e03, + 1.685079e03, + 1.421479e03, + 1.175419e03, + 9.476516e02, + 7.388688e02, + 5.497130e02, + 3.807626e02, + 2.325417e02, + 1.054810e02, + -8.381903e-04, + 0.000000e00, + ] + ), +) +bk = xr.DataArray( + dims=["km1"], + attrs=dict(units="None", _FillValue=False), + data=np.array( + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.00106595, + 0.00412866, + 0.00900663, + 0.01554263, + 0.02359921, + 0.03305481, + 0.0438012, + 0.05574095, + 0.06878554, + 0.08285347, + 0.09786981, + 0.1137643, + 0.130471, + 0.1479275, + 0.1660746, + 0.1848558, + 0.2042166, + 0.2241053, + 0.2444716, + 0.2652672, + 0.286445, + 0.3079604, + 0.3297701, + 0.351832, + 0.3741062, + 0.3965532, + 0.4191364, + 0.4418194, + 0.4645682, + 0.48735, + 0.5101338, + 0.5328897, + 0.5555894, + 0.5782067, + 0.6007158, + 0.6230936, + 0.6452944, + 0.6672683, + 0.6889648, + 0.7103333, + 0.7313231, + 0.7518838, + 0.7719651, + 0.7915173, + 0.8104913, + 0.828839, + 0.846513, + 0.8634676, + 0.8796583, + 0.8950421, + 0.9095779, + 0.9232264, + 0.9359506, + 0.9477157, + 0.9584892, + 0.9682413, + 0.9769447, + 0.9845753, + 0.9911126, + 0.9965372, + 1.0, + ] + ), +) +coefficients = xr.Dataset(data_vars={"ak": ak, "bk": bk}) +coefficients.to_netcdf("eta79.nc") + + +# km = 91 +ak = xr.DataArray( + dims=["km1"], + attrs=dict(units="Pa", _FillValue=False), + data=np.array( + [ + 1.00000000e00, + 1.75000000e00, + 2.75000000e00, + 4.09999990e00, + 5.98951054e00, + 8.62932968e00, + 1.22572632e01, + 1.71510906e01, + 2.36545467e01, + 3.21627693e01, + 4.31310921e01, + 5.71100426e01, + 7.46595764e01, + 9.64470978e01, + 1.23169769e02, + 1.55601318e02, + 1.94594009e02, + 2.41047531e02, + 2.95873840e02, + 3.60046967e02, + 4.34604828e02, + 5.20628723e02, + 6.19154846e02, + 7.31296021e02, + 8.58240906e02, + 1.00106561e03, + 1.16092859e03, + 1.33903992e03, + 1.53650012e03, + 1.75448938e03, + 1.99417834e03, + 2.25667407e03, + 2.54317139e03, + 2.85476392e03, + 3.19258569e03, + 3.55775366e03, + 3.95135107e03, + 4.37428662e03, + 4.82711084e03, + 5.31022168e03, + 5.82387793e03, + 6.36904248e03, + 6.94875244e03, + 7.56691992e03, + 8.22634277e03, + 8.93120996e03, + 9.68446191e03, + 1.04822725e04, + 1.13182793e04, + 1.21840771e04, + 1.30655674e04, + 1.39532207e04, + 1.48307285e04, + 1.56872617e04, + 1.65080645e04, + 1.72810996e04, + 1.79942988e04, + 1.86363223e04, + 1.91961797e04, + 1.96640723e04, + 2.00301914e04, + 2.02853691e04, + 2.04215254e04, + 2.04300684e04, + 2.03028730e04, + 2.00323711e04, + 1.96110664e04, + 1.90313848e04, + 1.82866426e04, + 1.73777930e04, + 1.63224639e04, + 1.51444033e04, + 1.38725674e04, + 1.25404785e04, + 1.11834170e04, + 9.83532715e03, + 8.52630664e03, + 7.28224512e03, + 6.12326074e03, + 5.06350684e03, + 4.11124902e03, + 3.27000122e03, + 2.53922729e03, + 1.91530762e03, + 1.39244995e03, + 9.63134766e02, + 6.20599365e02, + 3.57989502e02, + 1.69421387e02, + 5.10314941e01, + 2.48413086e00, + 0.00000000e00, + ] + ), +) +bk = xr.DataArray( + dims=["km1"], + attrs=dict(units="None", _FillValue=False), + data=np.array( + [ + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 3.50123992e-06, + 2.81484008e-05, + 9.38666999e-05, + 2.28561999e-04, + 5.12343016e-04, + 1.04712998e-03, + 1.95625005e-03, + 3.42317997e-03, + 5.58632007e-03, + 8.65428988e-03, + 1.27844000e-02, + 1.81719996e-02, + 2.49934997e-02, + 3.34198996e-02, + 4.36249003e-02, + 5.57769015e-02, + 7.00351968e-02, + 8.65636021e-02, + 1.05520003e-01, + 1.27051994e-01, + 1.51319996e-01, + 1.78477004e-01, + 2.08675995e-01, + 2.42069006e-01, + 2.78813988e-01, + 3.19043010e-01, + 3.62558991e-01, + 4.08596009e-01, + 4.56384987e-01, + 5.05111992e-01, + 5.53902984e-01, + 6.01903021e-01, + 6.48333013e-01, + 6.92534983e-01, + 7.33981013e-01, + 7.72292018e-01, + 8.07236016e-01, + 8.38724971e-01, + 8.66774976e-01, + 8.91497016e-01, + 9.13065016e-01, + 9.31702971e-01, + 9.47658002e-01, + 9.61175978e-01, + 9.72495019e-01, + 9.81844008e-01, + 9.89410996e-01, + 9.95342016e-01, + 1.00000000e00, + ] + ), +) +coefficients = xr.Dataset(data_vars={"ak": ak, "bk": bk}) +coefficients.to_netcdf("eta91.nc") + +# km =