Skip to content
Snippets Groups Projects
Commit 6c3e7937 authored by Paolo Veglio's avatar Paolo Veglio
Browse files

addressed issue with labeling non-uniform coastal scenes

parent ebc79629
No related branches found
No related tags found
No related merge requests found
...@@ -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;
......
...@@ -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 anythings as land # start by defining everything 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 == 14) & (lsf == 1) | (lsf == 4) & (lat < 64.0)) idx = np.nonzero(((lsf == 1) | (lsf == 4)) & (eco == 14) & (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
......
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