Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fireatlas_nrt
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gcorradini
fireatlas_nrt
Commits
db7bbf27
Commit
db7bbf27
authored
3 years ago
by
screbec
Browse files
Options
Downloads
Patches
Plain Diff
script for mosaicking circumpolar modis tiles
parent
982995f3
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pre/mosaic_modis_tiles.py
+36
-0
36 additions, 0 deletions
pre/mosaic_modis_tiles.py
with
36 additions
and
0 deletions
pre/mosaic_modis_tiles.py
0 → 100644
+
36
−
0
View file @
db7bbf27
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 14 19:22:37 2022
@author: rebec
"""
import
os
if
'
GDAL_DATA
'
not
in
os
.
environ
:
os
.
environ
[
'
GDAL_DATA
'
]
=
r
'
C:/Users/rebec/anaconda3/envs/py3work/Library/share/gdal
'
os
.
environ
[
'
PROJ_LIB
'
]
=
r
'
C:/Users/rebec/anaconda3/envs/fireatlas/Library/share/proj
'
import
glob
import
rasterio
import
rasterio.mask
from
rasterio.merge
import
merge
for
year
in
range
(
2012
,
2021
):
pathLCT
=
'
D:/fire_atlas/Data/modis_lc_dave/
'
+
str
(
year
)
+
'
_LCT/
'
+
str
(
year
)
+
'
/
'
files
=
glob
.
glob
(
pathLCT
+
'
*
'
)
# merge sinusoidal modis land cover tiles to mosaic
filelist
=
[]
for
file
in
files
:
src
=
rasterio
.
open
(
file
)
filelist
.
append
(
src
)
# create and plot a mosiac
mosaic
,
out_trans
=
merge
(
filelist
)
# write out mosiac band
out_fp
=
pathLCT
+
'
merged.tif
'
out_meta
=
src
.
meta
.
copy
()
out_meta
.
update
({
"
driver
"
:
"
GTiff
"
,
"
height
"
:
mosaic
.
shape
[
1
],
"
width
"
:
mosaic
.
shape
[
2
],
"
transform
"
:
out_trans
})
with
rasterio
.
open
(
out_fp
,
"
w
"
,
**
out_meta
)
as
dest
:
dest
.
write
(
mosaic
)
\ No newline at end of file
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