From 75e61e485b6149dbbcd58562e76feac881a2ac68 Mon Sep 17 00:00:00 2001
From: Paolo Veglio <paolo.veglio@ssec.wisc.edu>
Date: Tue, 7 Nov 2023 18:08:54 +0000
Subject: [PATCH] added docstrings to test functions

---
 tests/test_spectral_tests.py | 81 +++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 42 deletions(-)

diff --git a/tests/test_spectral_tests.py b/tests/test_spectral_tests.py
index 37f279d..71397e9 100644
--- a/tests/test_spectral_tests.py
+++ b/tests/test_spectral_tests.py
@@ -1,3 +1,4 @@
+"""Spectral tests."""
 import os
 
 import numpy as np
@@ -13,47 +14,56 @@ import mvcm.spectral_tests as tst
 # CREATE PATHS
 @pytest.fixture
 def fixturepath():
+    """Get fixture path."""
     return os.path.join(os.path.dirname(__file__), "fixtures")
 
 
 @pytest.fixture
 def data_path():
+    """Get data path."""
     return "/ships19/hercules/pveglio/mvcm_cleanup"
 
 
 # SET FILENAME FIXTURES
 @pytest.fixture
 def thresholds_file(fixturepath):
+    """Set thresholds file name."""
     return os.path.join(fixturepath, "thresholds.mvcm.snpp.v0.0.1.yaml")
 
 
 @pytest.fixture
 def ref_confidence_file(data_path):
+    """Set reference confidence file name."""
     return os.path.join(data_path, "ref_confidence.nc")
 
 
 @pytest.fixture
 def data_file(data_path):
+    """Set data file name."""
     return os.path.join(data_path, "viirs_data_A2022173.1312.nc")
 
 
 # SET DATA FIXTURES
 @pytest.fixture
 def thresholds(thresholds_file):
+    """Load thresholds file."""
     return yaml.safe_load(open(thresholds_file))
 
 
 @pytest.fixture
 def data(data_file):
+    """Load data."""
     return xr.open_dataset(data_file)
 
 
 @pytest.fixture
 def ref_confidence(ref_confidence_file):
+    """Load reference data."""
     return xr.open_dataset(ref_confidence_file)
 
 
 def test_11um_test(data, thresholds, ref_confidence):
+    """Test 11um_test function."""
     cmin = np.ones(data.latitude.shape)
 
     for scene_name in [
@@ -62,9 +72,7 @@ def test_11um_test(data, thresholds, ref_confidence):
         "Polar_Day_Ocean",
         "Polar_Night_Ocean",
     ]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.test_11um("M15", cmin)
 
@@ -72,12 +80,11 @@ def test_11um_test(data, thresholds, ref_confidence):
 
 
 def test_surface_temperature_test(data, thresholds, ref_confidence):
+    """Test surface_temperature_test function."""
     cmin = np.ones(data.latitude.shape)
 
     for scene_name in ["Land_Night", "Polar_Night_Land"]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.surface_temperature_test("M15", data, cmin)
 
@@ -85,6 +92,7 @@ def test_surface_temperature_test(data, thresholds, ref_confidence):
 
 
 def test_sst_test(data, thresholds, ref_confidence):
+    """Test sst_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in [
         "Ocean_Day",
@@ -92,9 +100,7 @@ def test_sst_test(data, thresholds, ref_confidence):
         "Polar_Day_Ocean",
         "Polar_Night_Ocean",
     ]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.sst_test("M15", "M16", cmin)
 
@@ -102,6 +108,7 @@ def test_sst_test(data, thresholds, ref_confidence):
 
 
 def test_bt_diff_86_11um(data, thresholds, ref_confidence):
+    """Tet bt_diff_86_11um function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in [
         "Ocean_Day",
@@ -109,9 +116,7 @@ def test_bt_diff_86_11um(data, thresholds, ref_confidence):
         "Polar_Day_Ocean",
         "Polar_Night_Ocean",
     ]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.bt_diff_86_11um("M14-M15", cmin)
 
@@ -119,6 +124,7 @@ def test_bt_diff_86_11um(data, thresholds, ref_confidence):
 
 
 def test_11_12um_diff(data, thresholds, ref_confidence):
+    """Test 11_12um_diff function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in [
         "Land_Day",
@@ -140,9 +146,7 @@ def test_11_12um_diff(data, thresholds, ref_confidence):
         "Day_Snow",
         "Night_Snow",
     ]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.test_11_12um_diff("M15-M16", cmin)
 
@@ -150,19 +154,20 @@ def test_11_12um_diff(data, thresholds, ref_confidence):
 
 
 def test_bt_difference_11_4um_test_ocean():
+    """Test bt_difference_11_4um_test_ocean function."""
     pass
 
 
 def test_bt_difference_11_4um_test_land():
+    """Test bt_difference_11_4um_test_land function."""
     pass
 
 
 def test_variability_11um_test(data, thresholds, ref_confidence):
+    """Test variability_11um_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in ["Polar_Day_Ocean", "Polar_Night_Ocean"]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.variability_11um_test("M15", cmin)
 
@@ -170,6 +175,7 @@ def test_variability_11um_test(data, thresholds, ref_confidence):
 
 
 def test_oceanic_stratus_11_4um_test(data, thresholds, ref_confidence):
+    """Test oceanic_stratus_11_4um_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in [
         "Land_Day",
@@ -185,9 +191,7 @@ def test_oceanic_stratus_11_4um_test(data, thresholds, ref_confidence):
         "Polar_Day_Ocean",
         "Polar_Night_Ocean",
     ]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.oceanic_stratus_11_4um_test("M15-M12", cmin)
 
@@ -195,11 +199,10 @@ def test_oceanic_stratus_11_4um_test(data, thresholds, ref_confidence):
 
 
 def test_nir_reflectance_test(data, thresholds, ref_confidence):
+    """Test nir_reflectance_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in ["Ocean_Day", "Polar_Day_Ocean"]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.nir_reflectance_test("M07", cmin)
 
@@ -207,11 +210,10 @@ def test_nir_reflectance_test(data, thresholds, ref_confidence):
 
 
 def test_vis_nir_ratio_test(data, thresholds, ref_confidence):
+    """Test vis_nir_ratio_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in ["Ocean_Day", "Polar_Day_Ocean"]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.vis_nir_ratio_test("M07-M05ratio", cmin)
 
@@ -219,11 +221,10 @@ def test_vis_nir_ratio_test(data, thresholds, ref_confidence):
 
 
 def test_16_21um_reflectance_test(data, thresholds, ref_confidence):
+    """Test 16_21um_reflectance_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in ["Ocean_Day", "Polar_Day_Ocean"]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.test_16_21um_reflectance("M10", cmin)
 
@@ -231,6 +232,7 @@ def test_16_21um_reflectance_test(data, thresholds, ref_confidence):
 
 
 def test_visible_reflectance_test(data, thresholds, ref_confidence):
+    """Test visible_reflectance_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in [
         "Land_Day",
@@ -242,9 +244,7 @@ def test_visible_reflectance_test(data, thresholds, ref_confidence):
         "Polar_Day_Desert",
         "Polar_Day_Desert_Coast",
     ]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.visible_reflectance_test("M128", cmin)
 
@@ -252,11 +252,10 @@ def test_visible_reflectance_test(data, thresholds, ref_confidence):
 
 
 def test_GEMI_test(data, thresholds, ref_confidence):
+    """Test GEMI_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in ["Land_Day_Desert", "Polar_Day_Desert"]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.gemi_test("GEMI", cmin)
 
@@ -264,6 +263,7 @@ def test_GEMI_test(data, thresholds, ref_confidence):
 
 
 def test_1_38um_high_clouds_test(data, thresholds, ref_confidence):
+    """Test 1_38um_high_clouds_test function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in [
         "Land_Day",
@@ -278,9 +278,7 @@ def test_1_38um_high_clouds_test(data, thresholds, ref_confidence):
         "Ocean_Day",
         "Polar_Day_Ocean",
     ]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.test_1_38um_high_clouds("M09", cmin)
 
@@ -288,6 +286,7 @@ def test_1_38um_high_clouds_test(data, thresholds, ref_confidence):
 
 
 def test_4_12um_thin_cirrus_btd(data, thresholds, ref_confidence):
+    """Test 4_12um_thin_cirrus_btd function."""
     cmin = np.ones(data.latitude.shape)
     for scene_name in [
         "Land_Night",
@@ -295,9 +294,7 @@ def test_4_12um_thin_cirrus_btd(data, thresholds, ref_confidence):
         "Polar_Night_Snow",
         "Night_Snow",
     ]:
-        SceneType = tst.CloudTests(
-            data=data, scene_name=scene_name, thresholds=thresholds
-        )
+        SceneType = tst.CloudTests(data=data, scene_name=scene_name, thresholds=thresholds)
 
         cmin, bit = SceneType.thin_cirrus_4_12um_BTD_test("M13-M16", cmin)
 
-- 
GitLab