Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MVCM
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
Paolo Veglio
MVCM
Commits
6c3e7937
Commit
6c3e7937
authored
1 year ago
by
Paolo Veglio
Browse files
Options
Downloads
Patches
Plain Diff
addressed issue with labeling non-uniform coastal scenes
parent
ebc79629
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mvcm/c_tools/check_reg_uniformity.c
+8
-2
8 additions, 2 deletions
mvcm/c_tools/check_reg_uniformity.c
mvcm/scene.py
+24
-19
24 additions, 19 deletions
mvcm/scene.py
with
32 additions
and
21 deletions
mvcm/c_tools/check_reg_uniformity.c
+
8
−
2
View file @
6c3e7937
...
@@ -115,7 +115,10 @@ void check_reg_uniformity(int eles, int line_edge, int elem_edge, int scan, int
...
@@ -115,7 +115,10 @@ void check_reg_uniformity(int eles, int line_edge, int elem_edge, int scan, int
if
(
(
nwater
+
ncoast
)
==
ntotal
)
{
if
(
(
nwater
+
ncoast
)
==
ntotal
)
{
if
(
nwater
!=
ntotal
)
{
if
(
nwater
!=
ntotal
)
{
*
loc_uniform
=
0
;
// I am changing this to *loc_uniform = -2 from *loc_uniform = 0
// I need to be able to identify what pixels are non uniform and why
// in the python code
*
loc_uniform
=
-
2
;
// Provide "double coastlines".
// Provide "double coastlines".
*
coast
=
1
;
*
coast
=
1
;
*
land
=
1
;
*
land
=
1
;
...
@@ -130,7 +133,10 @@ void check_reg_uniformity(int eles, int line_edge, int elem_edge, int scan, int
...
@@ -130,7 +133,10 @@ void check_reg_uniformity(int eles, int line_edge, int elem_edge, int scan, int
}
}
else
{
else
{
*
loc_uniform
=
0
;
// I am changing this to *loc_uniform = -1 from *loc_uniform = 0
// I need to be able to identify what pixels are non uniform and why
// in the python code
*
loc_uniform
=
-
1
;
*
coast
=
1
;
*
coast
=
1
;
*
land
=
1
;
*
land
=
1
;
*
water
=
0
;
*
water
=
0
;
...
...
This diff is collapsed.
Click to expand it.
mvcm/scene.py
+
24
−
19
View file @
6c3e7937
...
@@ -134,35 +134,35 @@ def find_scene(data, sunglint_angle):
...
@@ -134,35 +134,35 @@ def find_scene(data, sunglint_angle):
scene_flag
[
'
sunglint
'
][
idx
]
=
1
scene_flag
[
'
sunglint
'
][
idx
]
=
1
# Force consistency between lsf and ecosystem type for water
# Force consistency between lsf and ecosystem type for water
idx
=
np
.
nonzero
((
lsf
==
0
)
|
(
lsf
>=
5
)
&
(
lsf
<
7
))
idx
=
np
.
nonzero
((
lsf
==
0
)
|
(
(
lsf
>=
5
)
&
(
lsf
<
7
))
)
eco
[
idx
]
=
14
eco
[
idx
]
=
14
# start by defining
an
ything
s
as land
# start by defining
ever
ything as land
scene_flag
[
'
land
'
]
=
np
.
ones
((
dim1
,
dim2
))
scene_flag
[
'
land
'
]
=
np
.
ones
((
dim1
,
dim2
))
scene_flag
[
'
water
'
]
=
np
.
zeros
((
dim1
,
dim2
))
scene_flag
[
'
water
'
]
=
np
.
zeros
((
dim1
,
dim2
))
# Fix-up for missing ecosystem data in eastern Greenland and north-eastern Siberia.
# Fix-up for missing ecosystem data in eastern Greenland and north-eastern Siberia.
# Without this, these regions become completely "coast".
# Without this, these regions become completely "coast".
idx
=
np
.
nonzero
((
lsf
!=
255
)
&
(
lsf
==
1
)
|
(
lsf
==
4
))
idx
=
np
.
nonzero
((
lsf
!=
255
)
&
(
(
lsf
==
1
)
|
(
lsf
==
4
))
)
scene_flag
[
'
land
'
][
idx
]
=
1
scene_flag
[
'
land
'
][
idx
]
=
1
# idx = np.nonzero((lsf != 255) & (eco == 14))
# idx = np.nonzero((lsf != 255) & (eco == 14))
idx
=
np
.
nonzero
((
lsf
!=
255
)
&
(
eco
==
1
4
)
&
(
lsf
==
1
)
|
(
lsf
==
4
)
&
(
lat
<
64.0
))
idx
=
np
.
nonzero
((
(
lsf
==
1
)
|
(
lsf
==
4
)
)
&
(
eco
==
1
4
)
&
(
lat
<
64.0
))
scene_flag
[
'
coast
'
][
idx
]
=
1
scene_flag
[
'
coast
'
][
idx
]
=
1
idx
=
np
.
nonzero
(
(
lsf
!=
255
)
&
(
eco
==
14
)
&
(
lsf
==
1
)
|
(
lsf
==
4
)
&
idx
=
np
.
nonzero
((
eco
==
14
)
&
(
(
lsf
==
1
)
|
(
lsf
==
4
)
)
&
(
lat
>=
67.5
)
&
(
lon
<
-
40.0
)
&
(
lon
>
-
168.6
))
(
(
lat
>=
67.5
)
&
(
lon
<
-
40.0
)
&
(
lon
>
-
168.6
))
)
scene_flag
[
'
coast
'
][
idx
]
=
1
scene_flag
[
'
coast
'
][
idx
]
=
1
idx
=
np
.
nonzero
(
(
lsf
!=
255
)
&
(
eco
==
14
)
&
(
lsf
==
1
)
|
(
lsf
==
4
)
&
idx
=
np
.
nonzero
((
eco
==
14
)
&
(
(
lsf
==
1
)
|
(
lsf
==
4
)
)
&
(
lat
>=
67.5
)
&
(
lon
>
-
12.5
))
(
(
lat
>=
67.5
)
&
(
lon
>
-
12.5
))
)
scene_flag
[
'
coast
'
][
idx
]
=
1
scene_flag
[
'
coast
'
][
idx
]
=
1
idx
=
np
.
nonzero
(
(
lsf
!=
255
)
&
(
eco
==
14
)
&
(
lsf
==
1
)
|
(
lsf
==
4
)
&
idx
=
np
.
nonzero
((
eco
==
14
)
&
(
(
lsf
==
1
)
|
(
lsf
==
4
)
)
&
(
lat
>=
64.0
)
&
(
lat
<
67.5
)
&
(
lon
<
-
40.0
)
&
(
lon
>
-
168.5
))
(
(
lat
>=
64.0
)
&
(
lat
<
67.5
)
&
(
lon
<
-
40.0
)
&
(
lon
>
-
168.5
))
)
scene_flag
[
'
coast
'
][
idx
]
=
1
scene_flag
[
'
coast
'
][
idx
]
=
1
idx
=
np
.
nonzero
(
(
lsf
!=
255
)
&
(
eco
==
14
)
&
(
lsf
==
1
)
|
(
lsf
==
4
)
&
idx
=
np
.
nonzero
((
eco
==
14
)
&
(
(
lsf
==
1
)
|
(
lsf
==
4
)
)
&
(
lat
>=
64.0
)
&
(
lat
<
67.5
)
&
(
lon
>
-
30.0
))
(
(
lat
>=
64.0
)
&
(
lat
<
67.5
)
&
(
lon
>
-
30.0
))
)
scene_flag
[
'
coast
'
][
idx
]
=
1
scene_flag
[
'
coast
'
][
idx
]
=
1
idx
=
np
.
nonzero
(
lsf
==
2
)
idx
=
np
.
nonzero
(
lsf
==
2
)
...
@@ -173,7 +173,7 @@ def find_scene(data, sunglint_angle):
...
@@ -173,7 +173,7 @@ def find_scene(data, sunglint_angle):
scene_flag
[
'
land
'
][
idx
]
=
1
scene_flag
[
'
land
'
][
idx
]
=
1
scene_flag
[
'
sh_lake
'
][
idx
]
=
1
scene_flag
[
'
sh_lake
'
][
idx
]
=
1
idx
=
np
.
nonzero
((
lsf
==
0
)
|
(
lsf
>=
5
)
&
(
lsf
<=
7
))
idx
=
np
.
nonzero
((
lsf
==
0
)
|
(
(
lsf
>=
5
)
&
(
lsf
<=
7
))
)
scene_flag
[
'
water
'
][
idx
]
=
1
scene_flag
[
'
water
'
][
idx
]
=
1
scene_flag
[
'
land
'
][
idx
]
=
0
scene_flag
[
'
land
'
][
idx
]
=
0
...
@@ -312,6 +312,11 @@ def find_scene(data, sunglint_angle):
...
@@ -312,6 +312,11 @@ def find_scene(data, sunglint_angle):
scene_flag
[
'
uniform
'
]
=
anc
.
py_check_reg_uniformity
(
eco
,
eco
,
snowfr
,
icefr
,
lsf
)[
'
loc_uniform
'
]
scene_flag
[
'
uniform
'
]
=
anc
.
py_check_reg_uniformity
(
eco
,
eco
,
snowfr
,
icefr
,
lsf
)[
'
loc_uniform
'
]
# print(scene_flag['uniform'][:10, :10])
# print(scene_flag['uniform'][:10, :10])
# NOTE: These three lines need to be verified. They seem correct but I need to make sure
scene_flag
[
'
water
'
][
scene_flag
[
'
uniform
'
]
<
0
]
=
0
scene_flag
[
'
coast
'
][
scene_flag
[
'
uniform
'
]
<
0
]
=
1
scene_flag
[
'
land
'
][
scene_flag
[
'
uniform
'
]
<
0
]
=
1
# TEMP VALUES FOR DEBUGGING
# TEMP VALUES FOR DEBUGGING
scene_flag
[
'
lat
'
]
=
lat
scene_flag
[
'
lat
'
]
=
lat
scene_flag
[
'
lon
'
]
=
lon
scene_flag
[
'
lon
'
]
=
lon
...
@@ -326,16 +331,16 @@ def scene_id(scene_flag):
...
@@ -326,16 +331,16 @@ def scene_id(scene_flag):
# Ocean Day
# Ocean Day
idx
=
np
.
nonzero
((
scene_flag
[
'
water
'
]
==
1
)
&
(
scene_flag
[
'
day
'
]
==
1
)
&
idx
=
np
.
nonzero
((
scene_flag
[
'
water
'
]
==
1
)
&
(
scene_flag
[
'
day
'
]
==
1
)
&
(
scene_flag
[
'
ice
'
]
==
0
)
&
(
scene_flag
[
'
snow
'
]
==
0
)
&
(
(
scene_flag
[
'
ice
'
]
==
0
)
|
(
scene_flag
[
'
snow
'
]
==
0
)
))
#
&
(
scene_flag
[
'
polar
'
]
==
0
)
&
(
scene_flag
[
'
antarctica
'
]
==
0
)
&
#
(scene_flag['polar'] == 0) & (scene_flag['antarctica'] == 0) &
(
scene_flag
[
'
coast
'
]
==
0
)
&
(
scene_flag
[
'
desert
'
]
==
0
))
#
(scene_flag['coast'] == 0) & (scene_flag['desert'] == 0))
scene
[
'
Ocean_Day
'
][
idx
]
=
1
scene
[
'
Ocean_Day
'
][
idx
]
=
1
# Ocean Night
# Ocean Night
idx
=
np
.
nonzero
((
scene_flag
[
'
water
'
]
==
1
)
&
(
scene_flag
[
'
night
'
]
==
1
)
&
idx
=
np
.
nonzero
((
scene_flag
[
'
water
'
]
==
1
)
&
(
scene_flag
[
'
night
'
]
==
1
)
&
(
scene_flag
[
'
ice
'
]
==
0
)
&
(
scene_flag
[
'
snow
'
]
==
0
)
&
(
(
scene_flag
[
'
ice
'
]
==
0
)
|
(
scene_flag
[
'
snow
'
]
==
0
)
))
#
&
(
scene_flag
[
'
polar
'
]
==
0
)
&
(
scene_flag
[
'
antarctica
'
]
==
0
)
&
#
(scene_flag['polar'] == 0) & (scene_flag['antarctica'] == 0) &
(
scene_flag
[
'
coast
'
]
==
0
)
&
(
scene_flag
[
'
desert
'
]
==
0
))
#
(scene_flag['coast'] == 0) & (scene_flag['desert'] == 0))
scene
[
'
Ocean_Night
'
][
idx
]
=
1
scene
[
'
Ocean_Night
'
][
idx
]
=
1
# Land Day
# Land Day
...
...
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