SnowMapPy 1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ import unittest
2
+ import sys
3
+ import os
4
+
5
+
6
+ class TestQuality(unittest.TestCase):
7
+ """Test quality control functions."""
8
+
9
+ def test_get_valid_modis_classes(self):
10
+ """Test getting valid MODIS classes."""
11
+ # Test the expected valid classes manually
12
+ expected_valid_classes = [1, 2, 3] # snow, no snow, water
13
+
14
+ # Verify these are the correct valid classes
15
+ class_descriptions = {
16
+ 1: "Snow",
17
+ 2: "No snow",
18
+ 3: "Water"
19
+ }
20
+
21
+ for class_val in expected_valid_classes:
22
+ self.assertIn(class_val, class_descriptions)
23
+
24
+ self.assertEqual(expected_valid_classes, [1, 2, 3])
25
+
26
+ def test_get_invalid_modis_classes(self):
27
+ """Test getting invalid MODIS classes."""
28
+ # Test the expected invalid classes manually
29
+ expected_invalid_classes = [200, 201, 211, 237, 239, 250, 254]
30
+
31
+ # Verify these are the correct invalid classes from GEE documentation
32
+ class_descriptions = {
33
+ 200: "Missing data",
34
+ 201: "No decision",
35
+ 211: "Night",
36
+ 237: "Inland water",
37
+ 239: "Ocean",
38
+ 250: "Cloud",
39
+ 254: "Detector saturated"
40
+ }
41
+
42
+ for class_val in expected_invalid_classes:
43
+ self.assertIn(class_val, class_descriptions)
44
+
45
+ self.assertEqual(expected_invalid_classes, [200, 201, 211, 237, 239, 250, 254])
46
+
47
+ def test_validate_modis_class(self):
48
+ """Test MODIS class validation logic."""
49
+ valid_classes = [1, 2, 3]
50
+ invalid_classes = [200, 201, 211, 237, 239, 250, 254]
51
+
52
+ # Test valid classes
53
+ self.assertTrue(1 in valid_classes) # snow
54
+ self.assertTrue(2 in valid_classes) # no snow
55
+ self.assertTrue(3 in valid_classes) # water
56
+
57
+ # Test invalid classes
58
+ self.assertFalse(200 in valid_classes) # missing data
59
+ self.assertFalse(250 in valid_classes) # cloud
60
+ self.assertFalse(254 in valid_classes) # detector saturated
61
+
62
+ # Test that invalid classes are in the invalid list
63
+ self.assertTrue(200 in invalid_classes)
64
+ self.assertTrue(250 in invalid_classes)
65
+ self.assertTrue(254 in invalid_classes)
66
+
67
+
68
+ if __name__ == '__main__':
69
+ unittest.main()
@@ -0,0 +1 @@
1
+ # Local module tests