diff --git a/modules/util/util.py b/modules/util/util.py index e86cd3779135f14e4b8d99515a29b92695ddb7c4..7cbed72c11dfb8532390cbab95d7618ba31aa467 100644 --- a/modules/util/util.py +++ b/modules/util/util.py @@ -185,21 +185,21 @@ def value_to_index(nda, value): return idx -# array solzen must be degrees, missing values must NaN. For small 50x50km regions only -def is_night(solzen, test_angle=80.0, threshold=0.10): +# array solzen must be degrees, missing values must NaN. For small roughly 50x50km regions only +def is_day(solzen, test_angle=80.0): solzen = solzen.flatten() solzen = solzen[np.invert(np.isnan(solzen))] - if len(solzen) == 0 or (np.sum(solzen > test_angle) / len(solzen)) > threshold: - return True - else: + if len(solzen) == 0 or np.sum(solzen <= test_angle) < len(solzen): return False + else: + return True # array solzen must be degrees, missing values must NaN. For small roughly 50x50km regions only -def is_day(solzen, test_angle=75.0): +def is_night(solzen, test_angle=100.0): solzen = solzen.flatten() solzen = solzen[np.invert(np.isnan(solzen))] - if len(solzen) == 0 or np.sum(solzen <= test_angle) < len(solzen): + if len(solzen) == 0 or np.sum(solzen >= test_angle) < len(solzen): return False else: - return True + return True \ No newline at end of file