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
91a051b0
Commit
91a051b0
authored
May 21, 2018
by
Alfonso Ramire Pedraza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update
parent
dc24c7dd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
23 deletions
+70
-23
APISentinel.pyc
geosentinel/APISentinel.pyc
+0
-0
JP2ToJPGSubset.py
geosentinel/JP2ToJPGSubset.py
+64
-0
Merge.py
geosentinel/Merge.py
+5
-21
__init__.pyc
geosentinel/__init__.pyc
+0
-0
readProduct.pyc
geosentinel/readProduct.pyc
+0
-0
tools.py
geosentinel/tools.py
+1
-2
tools.pyc
geosentinel/tools.pyc
+0
-0
No files found.
geosentinel/APISentinel.pyc
deleted
100644 → 0
View file @
dc24c7dd
File deleted
geosentinel/JP2ToJPGSubset.py
0 → 100644
View file @
91a051b0
# -*- coding: utf-8 -*-
# @package JP2ToJPGSubSet Sentinel Files
"""
Example:
$ python -m doctest -v JP2ToJPGSubSet.py
"""
import
os
,
sys
,
numpy
as
np
from
tools
import
(
tools
)
from
osgeo
import
gdal
,
ogr
,
osr
class
JP2ToJPG_SubSet
(
object
):
""" Class for Sentinel satellites configuration
Test Case
>>> Files = tools("all") #IW_SLC,IW_GRDH,MSIL1C
>>> dir="make/"
>>> platform='Sentinel-2'
>>> list_files=Files.findFilesSentinel(dir,platform,2)#4 for resample_subset.dim
>>> print 'There is/are
%
d '
%
len(list_files) + platform + ' file(s)'
>>> lat1=20.795
>>> lon1=-103.714
>>> lat2=20.165
>>> lon2=-103.086
>>> TypeMerge="RGB"
>>> Convert=JP2ToJPG_SubSet(TypeMerge)
>>> for image in list_files:
... file = dir + "/"+ image
... products = Files.search_band_combination(file,TypeMerge)
... print"Applying Convert JP2 To JPEG and SubSet... ", image
... Convert.Convert_SubSet(lat1, lon1, lon2, lat2, products)
"""
def
__init__
(
self
,
TypeMerge
):
"""The constructor Initialize Sentinel Data.
Args:
self: The object pointer.
TypeMerge (str): RGB
Returns:
pointer: The object pointer.
"""
self
.
ext
=
".jpg"
self
.
SubSet
=
"_SubSet"
self
.
Type_Merge
=
"_"
+
TypeMerge
def
Convert_SubSet
(
self
,
lat1
,
lon1
,
lon2
,
lat2
,
products
):
"""Index Files Sentinel
Args:
self (pointer): The object pointer.
lat1 (float): World Geodetic System 1984.
lon1 (float): World Geodetic System 1984.
lon2 (float): World Geodetic System 1984.
lat2 (float): World Geodetic System 1984.
files (str): local path to image.
"""
for
i
in
products
:
outDS
=
i
[:
-
4
]
+
self
.
SubSet
+
self
.
ext
translate
=
'gdal_translate -projwin
%
s
%
s
%
s
%
s -projwin_srs WGS84 -ot Byte -scale 0 4096 0 255 -of JPEG
%
s
%
s'
%
(
lon1
,
lat1
,
lon2
,
lat2
,
i
,
outDS
)
os
.
system
(
translate
)
\ No newline at end of file
geosentinel/Merge.py
View file @
91a051b0
...
@@ -26,16 +26,17 @@ class Merge(object):
...
@@ -26,16 +26,17 @@ class Merge(object):
>>> Files = tools("all") #IW_SLC,IW_GRDH,MSIL1C
>>> Files = tools("all") #IW_SLC,IW_GRDH,MSIL1C
>>> dir="make/"
>>> dir="make/"
>>> platform='Sentinel-2'
>>> platform='Sentinel-2'
>>> list_files=Files.findFilesSentinel(dir,platform,
4
)#4 for resample_subset.dim
>>> list_files=Files.findFilesSentinel(dir,platform,
2
)#4 for resample_subset.dim
>>> print 'There is/are
%
d '
%
len(list_files) + platform + ' file(s)'
>>> print 'There is/are
%
d '
%
len(list_files) + platform + ' file(s)'
>>> Read=readProduct(dir,platform)
>>> Read=readProduct(dir,platform)
>>> TypeMerge="RGB"
>>> TypeMerge="RGB"
>>> Mergee=Merge(
"60",
TypeMerge)
>>> Mergee=Merge(TypeMerge)
>>> for image in list_files:
>>> for image in list_files:
... file = dir + image
... file = dir + image
... print"Applying SubSet... ", image
... products = Files.search_band_combination(file, TypeMerge)
... print"Applying Merge "+TypeMerge+"... ", image
... product=Read.ReadFilesSentinel(file,2)#The flag 2 ReadFiles .dim
... product=Read.ReadFilesSentinel(file,2)#The flag 2 ReadFiles .dim
... Mergee.merges(product, file)
... Mergee.merges(product,
products,
file)
"""
"""
def
__init__
(
self
,
TypeMerge
):
def
__init__
(
self
,
TypeMerge
):
...
@@ -53,7 +54,6 @@ class Merge(object):
...
@@ -53,7 +54,6 @@ class Merge(object):
self
.
looks
=
jpy
.
get_type
(
'org.esa.snap.core.datamodel.quicklooks.QuicklookGenerator'
)
self
.
looks
=
jpy
.
get_type
(
'org.esa.snap.core.datamodel.quicklooks.QuicklookGenerator'
)
self
.
File
=
jpy
.
get_type
(
'java.io.File'
)
self
.
File
=
jpy
.
get_type
(
'java.io.File'
)
#def merges(self, product, file):
def
merges
(
self
,
product
,
products
,
file
):
def
merges
(
self
,
product
,
products
,
file
):
"""Index Files Sentinel
"""Index Files Sentinel
...
@@ -122,19 +122,3 @@ class Merge(object):
...
@@ -122,19 +122,3 @@ class Merge(object):
output_dataset
.
GetRasterBand
(
3
)
.
WriteRaster
(
0
,
0
,
xsize
,
ysize
,
values3
)
output_dataset
.
GetRasterBand
(
3
)
.
WriteRaster
(
0
,
0
,
xsize
,
ysize
,
values3
)
output_dataset
=
None
output_dataset
=
None
Files
=
tools
(
"all"
)
#IW_SLC,IW_GRDH,MSIL1C
dir
=
"make/"
platform
=
'Sentinel-2'
list_files
=
Files
.
findFilesSentinel
(
dir
,
platform
,
2
)
#4 for resample_subset.dim
print
'There is/are
%
d '
%
len
(
list_files
)
+
platform
+
' file(s)'
Read
=
readProduct
(
dir
,
platform
)
TypeMerge
=
"RGB"
Mergee
=
Merge
(
TypeMerge
)
for
image
in
list_files
:
file
=
dir
+
image
products
=
Files
.
search_band_combination
(
file
,
TypeMerge
)
print
"Applying Merge "
+
TypeMerge
+
"... "
,
image
product
=
Read
.
ReadFilesSentinel
(
file
,
2
)
#The flag 2 ReadFiles .dim
#Mergee.merges(product, file)#for resample_subset.dim
Mergee
.
merges
(
product
,
products
,
file
)
#for .SAFE
geosentinel/__init__.pyc
deleted
100644 → 0
View file @
dc24c7dd
File deleted
geosentinel/readProduct.pyc
deleted
100644 → 0
View file @
dc24c7dd
File deleted
geosentinel/tools.py
View file @
91a051b0
...
@@ -14,7 +14,7 @@ class tools(object):
...
@@ -14,7 +14,7 @@ class tools(object):
>>> Files = tools('all')
>>> Files = tools('all')
>>> dir='make'
>>> dir='make'
>>> platform='Sentinel-2'
>>> platform='Sentinel-2'
>>> list_files=Files.findFilesSentinel(dir,platform
)
>>> list_files=Files.findFilesSentinel(dir,platform
,1)#Find 1=.zip, 2=.SAFE, 3 and 4=.dim
>>> print 'There is/are
%
d '
%
len(list_files) + platform + ' file(s)'
>>> print 'There is/are
%
d '
%
len(list_files) + platform + ' file(s)'
"""
"""
...
@@ -60,7 +60,6 @@ class tools(object):
...
@@ -60,7 +60,6 @@ class tools(object):
if
platform
==
"Sentinel-1"
:
if
platform
==
"Sentinel-1"
:
nam1
=
self
.
namfil1
nam1
=
self
.
namfil1
nam2
=
self
.
namfil2
nam2
=
self
.
namfil2
#files = [f for f in files if f.startswith(nam1) and f.endswith(ext) or f.startswith(nam2)]
if
platform
==
"Sentinel-2"
:
if
platform
==
"Sentinel-2"
:
nam1
=
self
.
namfil3
nam1
=
self
.
namfil3
nam2
=
self
.
namfil4
nam2
=
self
.
namfil4
...
...
geosentinel/tools.pyc
deleted
100644 → 0
View file @
dc24c7dd
File deleted
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