Repository: British-Oceanographic-Data-Centre/COAsT (language: python)

Issue:
Test



Discussion / hints:

Fix patch:
diff --git a/coast/__init__.py b/coast/__init__.py
index 7b083f4d..393cf630 100644
--- a/coast/__init__.py
+++ b/coast/__init__.py
@@ -22,3 +22,4 @@
 from .timeseries import Timeseries
 from .tidegauge import Tidegauge
 from .tidegauge_multiple import TidegaugeMultiple
+from .config_parser import ConfigParser
diff --git a/coast/config/__init__.py b/coast/config/__init__.py
deleted file mode 100644
index 55cacf0c..00000000
--- a/coast/config/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-from .config_parser import ConfigParser
diff --git a/coast/config/config_parser.py b/coast/config_parser.py
similarity index 100%
rename from coast/config/config_parser.py
rename to coast/config_parser.py
diff --git a/coast/config/config_structure.py b/coast/config_structure.py
similarity index 100%
rename from coast/config/config_structure.py
rename to coast/config_structure.py
diff --git a/coast/gridded.py b/coast/gridded.py
index a4ea6fa8..e95bae37 100644
--- a/coast/gridded.py
+++ b/coast/gridded.py
@@ -9,7 +9,7 @@
 
 from . import general_utils, stats_util
 from .coast import Coast
-from .config import ConfigParser
+from .config_parser import ConfigParser
 from .logging_util import get_slug, debug, info, warn, error, warning
 import pandas as pd
 
@@ -724,6 +724,7 @@ def get_e3_from_ssh(nemo_t, e3t=True, e3u=False, e3v=False, e3f=False, e3w=False
             # Add correction to e3u_0
             e3u_temp = e3u_temp + ds_dom.e3u_0[:, :, :-1]
             e3u_new = xr.zeros_like(e3t_new)
+            e3u_new = e3u_new.load()
             e3u_new[:, :, :, :-1] = e3u_temp
             e3u_new[:, :, :, -1] = ds_dom.e3u_0[:, :, -1]
             e3u_new["longitude"] = ds_dom.glamu
@@ -741,6 +742,7 @@ def get_e3_from_ssh(nemo_t, e3t=True, e3u=False, e3v=False, e3f=False, e3w=False
             e3v_temp = e3v_temp.where(e3v_temp.z_dim < ds_dom.bottom_level[:-1, :], 0)
             e3v_temp = e3v_temp + ds_dom.e3v_0[:, :-1, :]
             e3v_new = xr.zeros_like(e3t_new)
+            e3v_new = e3v_new.load()
             e3v_new[:, :, :-1, :] = e3v_temp
             e3v_new[:, :, -1, :] = ds_dom.e3v_0[:, -1, :]
             e3v_new["longitude"] = ds_dom.glamv
@@ -758,6 +760,7 @@ def get_e3_from_ssh(nemo_t, e3t=True, e3u=False, e3v=False, e3f=False, e3w=False
             e3f_temp = e3f_temp.where(e3f_temp.z_dim < ds_dom.bottom_level[:-1, :], 0)
             e3f_temp = e3f_temp + ds_dom.e3f_0[:, :-1, :]
             e3f_new = xr.zeros_like(e3t_new)
+            e3f_new = e3f_new.load()
             e3f_new[:, :, :-1, :] = e3f_temp
             e3f_new[:, :, -1, :] = ds_dom.e3f_0[:, -1, :]
             e3f_new["longitude"] = ds_dom.glamf
@@ -769,6 +772,7 @@ def get_e3_from_ssh(nemo_t, e3t=True, e3u=False, e3v=False, e3f=False, e3w=False
             # top levels correction same at e3t
             e3w_new = (ds_dom.e3w_0 + e3t_dt).transpose("t_dim", "z_dim", "y_dim", "x_dim")
             # levels between top and bottom
+            e3w_new = e3w_new.load()
             e3w_new[dict(z_dim=slice(1, None))] = (
                 0.5 * e3t_dt[:, :-1, :, :] + 0.5 * e3t_dt[:, 1:, :, :] + ds_dom.e3w_0[1:, :, :]
             )
diff --git a/coast/index.py b/coast/index.py
index 5b853a9c..a95b6a20 100644
--- a/coast/index.py
+++ b/coast/index.py
@@ -1,12 +1,12 @@
 """Index class."""
 from dask import array
 from dask.distributed import Client
-from .config import config_parser
 from .logging_util import get_slug, debug, info, warn, warning
 from typing import Union
 from pathlib import Path
 from ast import literal_eval
 from .coast import Coast
+from .config_parser import ConfigParser
 
 
 def setup_dask_client(workers: int = 2, threads: int = 2, memory_limit_per_worker: str = "2GB"):
@@ -30,7 +30,7 @@ def __init__(self, config: Union[Path, str] = None):
         self.keep_all_vars = False
 
         if config:
-            self.json_config = config_parser.ConfigParser(config)
+            self.json_config = ConfigParser(config)
             self.chunks = self.json_config.config.chunks
             self.dim_mapping = self.json_config.config.dataset.dimension_map
             self.var_mapping = self.json_config.config.dataset.variable_map
diff --git a/setup.py b/setup.py
index a2cee3a2..0803004f 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@
 PACKAGE = SimpleNamespace(
     **{
         "name": "COAsT",
-        "version": "1.2.2",
+        "version": "1.2.3",
         "description": "This is the Coast Ocean Assessment Tool",
         "url": "https://www.bodc.ac.uk",
         "download_url": "https://github.com/British-Oceanographic-Data-Centre/COAsT/",


Test patch:
diff --git a/tests/config/__init__.py b/tests/config/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/tests/config/config_parser_test.py b/tests/config_parser_test.py
similarity index 97%
rename from tests/config/config_parser_test.py
rename to tests/config_parser_test.py
index e8e4705d..b073486c 100644
--- a/tests/config/config_parser_test.py
+++ b/tests/config_parser_test.py
@@ -3,8 +3,8 @@
 import os
 from pathlib import Path
 import pytest
-from coast.config import ConfigParser
-from coast.config.config_structure import (
+from coast.config_parser import ConfigParser
+from coast.config_structure import (
     ConfigTypes,
     ConfigKeys,
     GriddedConfig,