Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hunan_index_py
Project
Project
Details
Activity
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
lixiao
hunan_index_py
Commits
7422e179
Commit
7422e179
authored
Oct 29, 2024
by
lixiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix landssat
parent
36f979e8
Pipeline
#9831
failed with stages
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
14 deletions
+16
-14
main.py
main.py
+15
-13
ImageProcessor.cpython-39.pyc
utils/__pycache__/ImageProcessor.cpython-39.pyc
+0
-0
__init__.cpython-39.pyc
utils/__pycache__/__init__.cpython-39.pyc
+0
-0
get_extent.cpython-310.pyc
utils/__pycache__/get_extent.cpython-310.pyc
+0
-0
get_extent.py
utils/get_extent.py
+1
-1
No files found.
main.py
View file @
7422e179
...
...
@@ -79,7 +79,8 @@ def get_s2_tif_name(input_config):
return
output_path
def
get_landsat_tif_name
(
input_config
):
parts
=
input_config
[
'input_path'
]
.
split
(
'_'
)
parts
=
os
.
path
.
basename
(
input_config
[
'input_path'
])
.
split
(
'_'
)
print
(
parts
)
# 获取当前时间并格式化
if
input_config
[
'index'
]
==
'NDWI'
:
index_name
=
'WaterExtraction'
...
...
@@ -89,6 +90,7 @@ def get_landsat_tif_name(input_config):
output_name
=
"_"
.
join
([
parts
[
0
],
parts
[
1
],
parts
[
3
],
parts
[
2
],
index_name
,
current_time
])
+
'.tif'
os
.
makedirs
(
input_config
[
"output_path"
],
exist_ok
=
True
)
output_path
=
os
.
path
.
join
(
input_config
[
'output_path'
],
output_name
)
print
(
output_path
)
return
output_path
def
visible_go
(
input_config
):
...
...
@@ -135,7 +137,7 @@ def visible_go(input_config):
if
input_config
[
'satellite'
]
==
'sentinel2'
:
json_path
=
input_config
[
'input_path'
]
.
replace
(
'metadata.xml'
,
'tileInfo.json'
)
if
input_config
[
'satellite'
]
==
'landsat'
:
json_path
=
input_config
[
'input_path'
]
.
replace
(
'MTL.xml'
,
'stac.json'
)
json_path
=
input_config
[
'input_path'
]
.
replace
(
'MTL.xml'
,
'
SR_
stac.json'
)
outjson_path
=
out_json
(
input_config
,
json_path
,
output_path
)
...
...
@@ -172,20 +174,20 @@ def visible_go(input_config):
if
__name__
==
"__main__"
:
input_config
=
{
"index"
:
"NDWI"
,
"satellite"
:
"sentinel2"
,
"input_path"
:
r"D:\hunan\50RKQ_l2a\metadata.xml"
,
"output_path"
:
r"D:\hunan\50RKQ_l2a\test2"
}
# input_config = {
# "index": "ND
V
I",
# "satellite": "
landsat
",
# "input_path": r"D:\hunan\
landsat_data\LC08_L2SP_122043_20231227_20240104_02_T1\LC08_L2SP_122043_20231227_20240104_02_T1_MTL
.xml",
# "output_path": r"D:\hunan\
landsat_data\LC08_L2SP_122043_20231227_20240104_02_T1\test\test_ndvi7.tif
"
# "index": "ND
W
I",
# "satellite": "
sentinel2
",
# "input_path": r"D:\hunan\
50RKQ_l2a\metadata
.xml",
# "output_path": r"D:\hunan\
50RKQ_l2a\test2
"
# }
input_config
=
{
"index"
:
"NDVI"
,
"satellite"
:
"landsat"
,
"input_path"
:
r"D:\hunan\landsat_data\LC08_L2SP_122043_20231227_20240104_02_T1\LC08_L2SP_122043_20231227_20240104_02_T1_MTL.xml"
,
"output_path"
:
r"D:\hunan\landsat_data\LC08_L2SP_122043_20231227_20240104_02_T1\test1"
}
# input_config = {
# "index": "NDWI",
# "satellite": "sentinel1",
...
...
utils/__pycache__/ImageProcessor.cpython-39.pyc
0 → 100644
View file @
7422e179
File added
utils/__pycache__/__init__.cpython-39.pyc
0 → 100644
View file @
7422e179
File added
utils/__pycache__/get_extent.cpython-310.pyc
View file @
7422e179
No preview for this file type
utils/get_extent.py
View file @
7422e179
...
...
@@ -71,7 +71,7 @@ def get_footprint(json_path, satellite):
elif
satellite
==
'landsat'
:
coordinates_wgs84
=
data
[
'geometry'
][
'coordinates'
]
coordinates_wgs84
=
data
[
'geometry'
][
'coordinates'
]
[
0
]
footprint
.
update
({
"coordinates"
:
[[
coordinates_wgs84
]]
...
...
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