Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
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
bf2302b2
Commit
bf2302b2
authored
Oct 05, 2018
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCL to JSON
parent
b23dd212
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
10 deletions
+16
-10
README.md
README.md
+1
-1
L2ASCLtoJSON.py
geosentinel/L2ASCLtoJSON.py
+3
-3
SCLimageListToJSON.sh
tools/SCLimageListToJSON.sh
+7
-0
mergeImages.sh
tools/mergeImages.sh
+4
-4
mergeImagesByDirectory.sh
tools/mergeImagesByDirectory.sh
+1
-2
No files found.
README.md
View file @
bf2302b2
...
...
@@ -130,7 +130,7 @@ This script count the total number of each of the 12 classes in a SCL image form
```
json
{
"wkt"
:
"POLYGON((-89.62955474853516 21.05230266883862,-89.55093383789061 21.05230266883862,-89.52930450439452 20.965126493194475,-89.6484375 20.873408465645696,-89.72877502441405 20.95294341625548,-89.65805053710938 21.056788298627097,-89.62955474853516 21.05230266883862))"
,
"filename"
:
"/home/geoint/NAS/data/mergecrop/20180214SCL_20m
_merged
.tif"
"filename"
:
"/home/geoint/NAS/data/mergecrop/20180214SCL_20m.tif"
}
```
```
bash
...
...
geosentinel/L2ASCLtoJSON.py
View file @
bf2302b2
...
...
@@ -22,12 +22,12 @@ def L2ASCLtoDict(filename, wkt):
return
dict
(
count
)
#-------------------------------------------------------------------------------
def
main
(
argv
):
if
len
(
sys
.
argv
)
!=
2
:
if
len
(
sys
.
argv
)
!=
3
:
print
(
"Usage: "
+
argv
[
0
]
+
" <JSON File>"
)
else
:
jsonFile
=
open
(
argv
[
1
])
.
read
()
jsonFile
=
open
(
argv
[
2
])
.
read
()
cfg
=
json
.
loads
(
jsonFile
)
dataDict
=
L2ASCLtoDict
(
cfg
[
"filename"
],
cfg
[
'wkt'
])
dataDict
=
L2ASCLtoDict
(
argv
[
1
],
cfg
[
'wkt'
])
print
(
dataDict
)
#-------------------------------------------------------------------------------
if
__name__
==
"__main__"
:
...
...
tools/SCLimageListToJSON.sh
0 → 100644
View file @
bf2302b2
#!/bin/sh
DIR
=
$1
CGF
=
$2
JOBS
=
${
3
:-
1
}
cd
$DIR
ls
*
_SCL_20m.tif | parallel
--jobs
$JOBS
L2ASCLtoJSON.py
{}
$2
tools/mergeImages.sh
View file @
bf2302b2
...
...
@@ -9,7 +9,7 @@ cd $DIR
DIRNAME
=
$(
echo
$DIR
|
cut
-d
"/"
-f1
)
echo
$DIRNAME
##------------------------------------------------------------------------------
MERGEDIMAGE
=
$DIRNAME
"TCI_10m_merged.tif"
MERGEDIMAGE
=
$DIRNAME
"
_
TCI_10m_merged.tif"
if
[
!
-e
$MERGEDIMAGE
]
;
then
echo
"gdal_merge.py -o "
$MERGEDIMAGE
$(
ls
*
TCI_10m.jp2
)
gdal_merge.py
-o
$MERGEDIMAGE
$(
ls
*
TCI_10m.jp2
)
...
...
@@ -17,14 +17,14 @@ else
echo
PASSING
$MERGEDIMAGE
FOUND
fi
CROPEDIMAGE
=
../merge
crop/
$DIRNAME
"TCI_10m_mergedcroped
.tif"
CROPEDIMAGE
=
../merge
d/
$DIRNAME
"_TCI_10m
.tif"
if
[
!
-e
$CROPEDIMAGE
]
;
then
gdal_translate
-projwin
$BOX
-projwin_srs
WGS84
-ot
Byte
-of
JPEG
$MERGEDIMAGE
$CROPEDIMAGE
else
echo
PASSING
$CROPEDIMAGE
FOUND
fi
##------------------------------------------------------------------------------
MERGEDIMAGE
=
$DIRNAME
"SCL_20m_merged.tif"
MERGEDIMAGE
=
$DIRNAME
"
_
SCL_20m_merged.tif"
if
[
!
-e
$MERGEDIMAGE
]
;
then
echo
"gdal_merge.py -o "
$MERGEDIMAGE
$(
ls
*
SCL_20m.jp2
)
gdal_merge.py
-o
$MERGEDIMAGE
$(
ls
*
SCL_20m.jp2
)
...
...
@@ -32,7 +32,7 @@ else
echo
PASSING
$MERGEDIMAGE
FOUND
fi
CROPEDIMAGE
=
../merge
crop/
$DIRNAME
"SCL_20m_merged
.tif"
CROPEDIMAGE
=
../merge
d/
$DIRNAME
"_SCL_20m
.tif"
if
[
!
-e
$CROPEDIMAGE
]
;
then
gdal_translate
-projwin
$BOX
-projwin_srs
WGS84
-ot
Byte
-of
JPEG
$MERGEDIMAGE
$CROPEDIMAGE
else
...
...
tools/mergeImagesByDirectory.sh
View file @
bf2302b2
...
...
@@ -11,8 +11,7 @@ if [ "$#" -le 1 ]; then
fi
cd
$JP2DIR
mkdir
mergecrop
mkdir
cropmerge
mkdir
merged
ls
-d
*
/ | parallel
-q
--jobs
$JOBS
mergeImages.sh
{}
"
$POLYGON
"
find
.
-name
*
.xml
-type
f
-delete
...
...
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