EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESA
PRISM
VS
Commits
d98b484b
Commit
d98b484b
authored
4 years ago
by
Fabian Schindler
Browse files
Options
Downloads
Patches
Plain Diff
Fixing Sentinel-2 registration schema
parent
a6385847
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!61
Staging to master 1.3.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/registrar/scheme.py
+20
-16
20 additions, 16 deletions
core/registrar/scheme.py
with
20 additions
and
16 deletions
core/registrar/scheme.py
+
20
−
16
View file @
d98b484b
...
...
@@ -12,6 +12,7 @@ from .exceptions import RegistrationError
logger
=
logging
.
getLogger
(
__name__
)
class
RegistrationScheme
:
def
get_context
(
self
)
->
List
[
Context
]:
raise
NotImplementedError
...
...
@@ -36,8 +37,7 @@ def parse_footprint(value):
class
Sentinel2RegistrationScheme
(
RegistrationScheme
):
name
=
'
sentinel-2-l2a
'
name
=
'
sentinel-2
'
MTD_SCHEMAS
=
{
'
MSIL1C
'
:
{
...
...
@@ -94,19 +94,19 @@ class Sentinel2RegistrationScheme(RegistrationScheme):
def
get_context
(
self
,
source
:
Source
,
path
:
str
)
->
List
[
Context
]:
try
:
metadata_file
=
join
(
path
,
'
MTD_MSIL2A.xml
'
)
mtd_schema
=
MTD_SCHEMAS
[
'
MSIL2A
'
]
mtd_namespaces
=
MTD_NAMESPACES
[
'
MSIL2A
'
]
mtd_tl_schema
=
MTD_TL_SCHEMAS
[
'
MSIL2A
'
]
mtd_tl_namespaces
=
MTD_TL_NAMESPACES
[
'
MSIL2A
'
]
tree
=
read_xml
(
source
,
metadata_file
)
mtd_schema
=
self
.
MTD_SCHEMAS
[
'
MSIL2A
'
]
mtd_namespaces
=
self
.
MTD_NAMESPACES
[
'
MSIL2A
'
]
mtd_tl_schema
=
self
.
MTD_TL_SCHEMAS
[
'
MSIL2A
'
]
mtd_tl_namespaces
=
self
.
MTD_TL_NAMESPACES
[
'
MSIL2A
'
]
except
:
except
Exception
:
metadata_file
=
join
(
path
,
'
MTD_MSIL1C.xml
'
)
mtd_schema
=
MTD_SCHEMAS
[
'
MSIL1C
'
]
mtd_namespaces
=
MTD_NAMESPACES
[
'
MSIL1C
'
]
mtd_tl_schema
=
MTD_TL_SCHEMAS
[
'
MSIL1C
'
]
mtd_tl_namespaces
=
MTD_TL_NAMESPACES
[
'
MSIL1C
'
]
tree
=
read_xml
(
source
,
metadata_file
)
tree
=
read_xml
(
source
,
metadata_file
)
mtd_schema
=
self
.
MTD_SCHEMAS
[
'
MSIL1C
'
]
mtd_namespaces
=
self
.
MTD_NAMESPACES
[
'
MSIL1C
'
]
mtd_tl_schema
=
self
.
MTD_TL_SCHEMAS
[
'
MSIL1C
'
]
mtd_tl_namespaces
=
self
.
MTD_TL_NAMESPACES
[
'
MSIL1C
'
]
# get product metadata
metadata
=
parse_metadata_schema
(
tree
,
mtd_schema
,
mtd_namespaces
)
...
...
@@ -204,7 +204,9 @@ class GSCRegistrationScheme(RegistrationScheme):
metadata_file
=
gsc_filenames
[
0
]
tree
=
read_xml
(
source
,
metadata_file
)
metadata
=
parse_metadata_schema
(
tree
,
self
.
GSC_SCHEMA
,
tree
.
getroot
().
nsmap
)
metadata
=
parse_metadata_schema
(
tree
,
self
.
GSC_SCHEMA
,
tree
.
getroot
().
nsmap
)
tiff_files
=
{
metadata
[
'
type
'
]:
source
.
list_files
(
path
,
[
'
*.tif
'
,
'
*.TIF
'
])
...
...
@@ -294,6 +296,7 @@ REGISTRATION_SCHEMES = {
'
stac-item
'
:
STACCollectionScheme
,
}
def
get_scheme
(
config
:
dict
,
path
:
str
)
->
RegistrationScheme
:
cfg_schemes
=
config
[
'
schemes
'
]
...
...
@@ -305,10 +308,11 @@ def get_scheme(config: dict, path: str) -> RegistrationScheme:
break
else
:
# no source found
raise
RegistrationError
(
f
'
Could not find a suitable scheme for the path
{
path
}
'
)
raise
RegistrationError
(
f
'
Could not find a suitable scheme for the path
{
path
}
'
)
return
REGISTRATION_SCHEMES
[
cfg_scheme
[
'
type
'
]](
*
cfg_scheme
.
get
(
'
args
'
,
[]),
**
cfg_scheme
.
get
(
'
kwargs
'
,
{}),
)
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