Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
import yaml
import xarray as xr
import numpy as np
import pytest
import mvcm.spectral_tests as tst
@pytest.fixture
def fixturepath():
return os.path.join(os.path.dirname(__file__), 'fixtures')
@pytest.fixture
def thresholds_file(fixturepath):
return os.path.join(fixturepath, 'thresholds.mvcm.snpp.v0.0.1.yaml')
@pytest.fixture
def data_path():
return '/ships19/hercules/pveglio/mvcm_cleanup'
@pytest.fixture
def data_file(data_path):
return os.path.join(data_path, 'viirs_data_A2022173.1312.nc')
def test_11um_test(data_file, thresholds_file):
with open(thresholds_file, 'r') as f:
cfg_text = f.read()
thresholds = yaml.safe_load(cfg_text)
viirs_data = xr.open_dataset(data_file)
cmin = np.ones(viirs_data.latitude.shape)
for scene_name in ['Ocean_Day', 'Ocean_Night', 'Polar_Day_Ocean', 'Polar_Night_Ocean']:
SceneType = tst.CloudTests(data=viirs_data,
scene_name=scene_name,
thresholds=thresholds)
cmin, bit = SceneType.test_11um('M15', cmin)