Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Rink
python
Commits
ee0f2c6f
Commit
ee0f2c6f
authored
3 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
separate is_day, is_night functions
parent
d0e2b90c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/util/util.py
+8
-8
8 additions, 8 deletions
modules/util/util.py
with
8 additions
and
8 deletions
modules/util/util.py
+
8
−
8
View file @
ee0f2c6f
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment