-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCreate_mosaic_dataset.py
More file actions
29 lines (26 loc) · 1.11 KB
/
Copy pathCreate_mosaic_dataset.py
File metadata and controls
29 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import arcpy
import calendar
import glob
import re
import os
arcpy.env.workspace = r"../Data"
os.chdir(arcpy.env.workspace)
rasters = glob.glob(r"/ALR_outputs/ALR_*.tif")
year_expr = "(?<=ALR_)[0-9]{4}"
month_expr = "(?<=20[0-9]{2})[0-9]{2}"
mosaic_fmt = "ALR_{}_{}_BIBE_300km"
for ras in rasters:
print(ras)
month_int = int(re.search(month_expr, ras).group(0))
yy = int(re.search(year_expr, ras).group(0))
msic = mosaic_fmt.format(yy, calendar.month_abbr[month_int])
arcpy.management.CreateMosaicDataset("NightRadiance.gdb", msic,
"GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],\
PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]",
None, '', "NONE", None)
arcpy.management.AddRastersToMosaicDataset("NightRadiance.gdb/" + msic, "Raster Dataset", ras,
"UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", "UPDATE_OVERVIEWS", None,
0, 1500, None, '', "SUBFOLDERS", "ALLOW_DUPLICATES", "BUILD_PYRAMIDS",
"CALCULATE_STATISTICS", "NO_THUMBNAILS", '', "NO_FORCE_SPATIAL_REFERENCE",
"ESTIMATE_STATISTICS", None, "NO_PIXEL_CACHE",
r"../AppData/Local/ESRI/rasterproxies/"+ msic)