Skip to content
Snippets Groups Projects
Commit ee0f2c6f authored by tomrink's avatar tomrink
Browse files

separate is_day, is_night functions

parent d0e2b90c
No related branches found
No related tags found
No related merge requests found
...@@ -185,21 +185,21 @@ def value_to_index(nda, value): ...@@ -185,21 +185,21 @@ def value_to_index(nda, value):
return idx return idx
# array solzen must be degrees, missing values must NaN. For small 50x50km regions only # array solzen must be degrees, missing values must NaN. For small roughly 50x50km regions only
def is_night(solzen, test_angle=80.0, threshold=0.10): def is_day(solzen, test_angle=80.0):
solzen = solzen.flatten() solzen = solzen.flatten()
solzen = solzen[np.invert(np.isnan(solzen))] solzen = solzen[np.invert(np.isnan(solzen))]
if len(solzen) == 0 or (np.sum(solzen > test_angle) / len(solzen)) > threshold: if len(solzen) == 0 or np.sum(solzen <= test_angle) < len(solzen):
return True
else:
return False return False
else:
return True
# array solzen must be degrees, missing values must NaN. For small roughly 50x50km regions only # 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.flatten()
solzen = solzen[np.invert(np.isnan(solzen))] 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 return False
else: else:
return True return True
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment