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
4f98dda2
Commit
4f98dda2
authored
Oct 30, 2024
by
lixiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add data size
parent
7422e179
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
get_extent.py
utils/get_extent.py
+7
-1
out_json.py
utils/out_json.py
+8
-1
No files found.
utils/get_extent.py
View file @
4f98dda2
...
...
@@ -3,7 +3,7 @@ from pyproj import Transformer
import
rasterio
import
numpy
as
np
import
json
import
re
import
re
,
os
def
get_epsg_code_rasterio
(
filepath
):
with
rasterio
.
open
(
filepath
)
as
dataset
:
...
...
@@ -51,6 +51,12 @@ def get_cloud_coverage(json_path, satellite):
return
cloud_coverage
,
dataTime
,
grid
def
get_tif_file_size
(
file_path
):
# 获取文件大小(字节)
file_size
=
os
.
path
.
getsize
(
file_path
)
# 转换为 MB
file_size_mb
=
file_size
/
(
1024
*
1024
)
return
file_size_mb
def
get_footprint
(
json_path
,
satellite
):
#哨兵2 tileInfo.json 中 tileDataGeometry
...
...
utils/out_json.py
View file @
4f98dda2
...
...
@@ -36,6 +36,12 @@ def get_file_timestamp_iso(tif_path):
timestamp_iso
=
timestamp_dt
.
isoformat
(
timespec
=
'seconds'
)
+
"Z"
return
timestamp_iso
def
get_tif_file_size
(
file_path
):
# 获取文件大小(字节)
file_size
=
os
.
path
.
getsize
(
file_path
)
# 转换为 MB
file_size_mb
=
file_size
/
(
1024
*
1024
)
return
file_size_mb
def
fill_productInfoList
(
tif_path
,
input_config
,
json_path
):
outputProductInfo
=
{
...
...
@@ -48,7 +54,8 @@ def fill_productInfoList(tif_path, input_config,json_path):
"outputProductInfo"
:
outputProductInfo
,
"extent"
:
get_extent
.
get_extent_wgs84
(
tif_path
),
"productionTime"
:
get_file_timestamp_iso
(
tif_path
),
"footprint"
:
get_extent
.
get_footprint
(
json_path
,
input_config
[
"satellite"
])
"footprint"
:
get_extent
.
get_footprint
(
json_path
,
input_config
[
"satellite"
]),
"dataSize"
:
get_tif_file_size
(
tif_path
)
}
input_template
[
'productInfoList'
][
0
]
.
update
(
productInfoList
...
...
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