Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
GeoSentinel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoSentinel
Commits
8e77c533
Commit
8e77c533
authored
Mar 13, 2019
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mario image merge
parent
de258520
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
9 deletions
+34
-9
imageMissingData.py
geosentinel/imageMissingData.py
+32
-7
L2ASCL_AreaProcessing.sh
tools/L2ASCL_AreaProcessing.sh
+2
-2
No files found.
geosentinel/imageMissingData.py
View file @
8e77c533
...
...
@@ -5,25 +5,50 @@ import osgeo.osr as osr
import
numpy
as
np
import
gdal
import
sys
,
os
import
json
########### lee archivo de configuración ################
dirname
=
os
.
path
.
dirname
(
__file__
)
configfile
=
os
.
path
.
join
(
dirname
,
'../config/config.json'
)
with
open
(
configfile
,
'r'
)
as
f
:
config
=
json
.
load
(
f
)
#print(config['PATHS']['PATH_GEOSENTINEL'])
SENTINEL_PATH
=
config
[
'PATHS'
][
'PATH_GEOSENTINEL'
]
###########################################################
sys
.
path
.
append
(
SENTINEL_PATH
)
from
geosentinel
import
rasterWkt
#-------------------------------------------------------------------------------
def
imageMissingData
(
filename
):
def
imageMissingData
(
filename
,
wkt
):
inputImage
=
gdal
.
Open
(
filename
)
rows
,
cols
,
geotransform
=
inputImage
.
RasterYSize
,
inputImage
.
RasterXSize
,
inputImage
.
GetGeoTransform
()
data
=
inputImage
.
GetRasterBand
(
1
)
.
ReadAsArray
(
0
,
0
,
cols
,
rows
)
rasterwkt
=
rasterWkt
.
getPolygonArray
(
inputImage
,
wkt
)
data
=
np
.
bitwise_and
(
data
,
rasterwkt
)
inputImage
=
None
return
(
data
>
0
)
.
sum
()
/
float
((
rows
*
cols
)
)
return
(
data
>
0
)
.
sum
()
/
(
rasterwkt
>
0
)
.
sum
(
)
#-------------------------------------------------------------------------------
def
main
(
argv
):
if
len
(
sys
.
argv
)
!=
3
:
print
(
"Usage: "
+
argv
[
0
]
+
" <File> <
%
>"
)
if
len
(
sys
.
argv
)
!=
4
:
print
(
"Usage: "
+
argv
[
0
]
+
" <File> <
JSON> <
%
>"
)
else
:
dataArea
=
imageMissingData
(
argv
[
1
])
if
dataArea
<
float
(
argv
[
2
])
/
100.0
:
print
(
"Deleting "
+
argv
[
1
]
+
" "
+
str
(
dataArea
))
jsonFile
=
open
(
argv
[
2
])
.
read
()
cfg
=
json
.
loads
(
jsonFile
)
dataArea
=
imageMissingData
(
argv
[
1
],
cfg
[
"wkt"
])
th
=
float
(
argv
[
3
])
/
100.0
if
dataArea
<
th
:
print
(
"Deleting "
+
argv
[
1
]
+
" "
+
str
(
dataArea
)
+
" < "
+
str
(
th
))
#os.system("rm " + argv[1])
else
:
print
(
"Keeping "
+
argv
[
1
]
+
" "
+
str
(
dataArea
))
...
...
tools/L2ASCL_AreaProcessing.sh
View file @
8e77c533
...
...
@@ -129,7 +129,7 @@ if [ $BYTILE -ne "0" ]; then
fi
cp
*
SCL_60m.tif SCL
cd
SCL
ls
*
.tif | parallel
--jobs
4 imageMissingData.py
{}
5
0
ls
*
.tif | parallel
--jobs
4 imageMissingData.py
{}
$USERDIR
"findproducts.json"
7
0
if
[
!
-d
"../TCI"
]
;
then
mkdir
../TCI
fi
...
...
@@ -149,7 +149,7 @@ else
fi
cp
*
SCL_60m.tif SCL
cd
SCL
ls
*
.tif | parallel
--jobs
4 imageMissingData.py
{}
5
0
ls
*
.tif | parallel
--jobs
4 imageMissingData.py
{}
$USERDIR
"findproducts.json"
7
0
if
[
!
-d
"../TCI"
]
;
then
mkdir
../TCI
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment