# 檔案說明
```
分群A : 降雨延時1小時
A1_0p1m_1hr.tif : 造成淹水深度達0.1公尺的雨量脆弱度(單位:1小時累積雨量mm)
A2_0p3m_1hr.tif : 造成淹水深度達0.3公尺的雨量脆弱度(單位:1小時累積雨量mm)
A3_0p5m_1hr.tif : 造成淹水深度達0.5公尺的雨量脆弱度(單位:1小時累積雨量mm)
A4_1p0m_1hr.tif : 造成淹水深度達1.0公尺的雨量脆弱度(單位:1小時累積雨量mm)
A5_2p0m_1hr.tif : 造成淹水深度達2.0公尺的雨量脆弱度(單位:1小時累積雨量mm)
分群B : 降雨延時3小時
B1_0p1m_3hr.tif : 造成淹水深度達0.1公尺的雨量脆弱度(單位:3小時累積雨量mm)
B2_0p3m_3hr.tif : 造成淹水深度達0.3公尺的雨量脆弱度(單位:3小時累積雨量mm)
B3_0p5m_3hr.tif : 造成淹水深度達0.5公尺的雨量脆弱度(單位:3小時累積雨量mm)
B4_1p0m_3hr.tif : 造成淹水深度達1.0公尺的雨量脆弱度(單位:3小時累積雨量mm)
B5_2p0m_3hr.tif : 造成淹水深度達2.0公尺的雨量脆弱度(單位:3小時累積雨量mm)
分群C : 降雨延時6小時
C1_0p1m_6hr.tif : 造成淹水深度達0.1公尺的雨量脆弱度(單位:6小時累積雨量mm)
C2_0p3m_6hr.tif : 造成淹水深度達0.3公尺的雨量脆弱度(單位:6小時累積雨量mm)
C3_0p5m_6hr.tif : 造成淹水深度達0.5公尺的雨量脆弱度(單位:6小時累積雨量mm)
C4_1p0m_6hr.tif : 造成淹水深度達1.0公尺的雨量脆弱度(單位:6小時累積雨量mm)
C5_2p0m_6hr.tif : 造成淹水深度達2.0公尺的雨量脆弱度(單位:6小時累積雨量mm)
分群D : 降雨延時12小時
D1_0p1m_12hr.tif : 造成淹水深度達0.1公尺的雨量脆弱度(單位:12小時累積雨量mm)
D2_0p3m_12hr.tif : 造成淹水深度達0.3公尺的雨量脆弱度(單位:12小時累積雨量mm)
D3_0p5m_12hr.tif : 造成淹水深度達0.5公尺的雨量脆弱度(單位:12小時累積雨量mm)
D4_1p0m_12hr.tif : 造成淹水深度達1.0公尺的雨量脆弱度(單位:12小時累積雨量mm)
D5_2p0m_12hr.tif : 造成淹水深度達2.0公尺的雨量脆弱度(單位:12小時累積雨量mm)
分群E : 降雨延時24小時
E1_0p1m_24hr.tif : 造成淹水深度達0.1公尺的雨量脆弱度(單位:24小時累積雨量mm)
E2_0p3m_24hr.tif : 造成淹水深度達0.3公尺的雨量脆弱度(單位:24小時累積雨量mm)
E3_0p5m_24hr.tif : 造成淹水深度達0.5公尺的雨量脆弱度(單位:24小時累積雨量mm)
E4_1p0m_24hr.tif : 造成淹水深度達1.0公尺的雨量脆弱度(單位:24小時累積雨量mm)
E5_2p0m_24hr.tif : 造成淹水深度達2.0公尺的雨量脆弱度(單位:24小時累積雨量mm)
```
# VRT
```
VRT 檔案是一種 XML 檔案,用於描述光柵資料的元資料和組織結構,而不包含實際的光柵資料。它可以引用其他光柵資料檔案,如 GeoTIFF、JPEG、PNG 等,並在邏輯上將它們組合為單一虛擬資料集。這使得你可以對多個光柵資料集進行邏輯上的組合、裁剪、重採樣等操作,而無需實際複製或修改原始資料。
VRT 檔案可用於許多地理資訊系統(GIS)軟體,例如 GDAL(地理資料抽象化庫)工具、QGIS 等。它提供了一種靈活且可擴展的方式來處理和操作光柵資料,使得資料處理和分析更加方便和高效。
通過撰寫 VRT 檔案,你可以定義光柵資料的元資料、空間參考資訊、像素大小、裁剪範圍、資料集合併等操作。VRT 檔案還支援各種光柵資料集操作,例如調整顏色、重採樣、重投影等。
總而言之,VRT 檔案是一種用於描述虛擬光柵資料集的 XML 檔案,允許你在不實際複製或修改光柵資料的情況下進行操作和處理。這為光柵資料的管理和分析提供了更大的靈活性和效率。
```
# Step1
- 利用vrt將分群的圖檔組成一個vrt檔案
```
gdalbuildvrt -separate merged.vrt A1_0p1m_1hr.tif A2_0p3m_1hr.tif A3_0p5m_1hr.tif A4_1p0m_1hr.tif A5_2p0m_1hr.tif
gdalinfo merged.vrt
```
# Step2
- 打開merged.vrt修改ColorInterp
- 這個tag就是之後用來query同一時間區間不同淹水高度的參數
<ColorInterp>A1hr0p1m</ColorInterp>
<ColorInterp>A1hr0p3m</ColorInterp>
- 編譯好的檔案如下
```
<VRTDataset rasterXSize="837" rasterYSize="1574">
<GeoTransform> 1.6201850000000000e+05, 4.0000000000000000e+01, 0.0000000000000000e+00, 2.5492605000000000e+06, 0.0000000000000000e+00, -4.0000000000000000e+01</GeoTransform>
<VRTRasterBand dataType="Float32" band="1">
<ColorInterp>A1hr0p1m</ColorInterp>
<NoDataValue>-99</NoDataValue>
<ComplexSource>
<SourceFilename relativeToVRT="1">A10p1m1hr_202305.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="837" RasterYSize="1574" DataType="Float32" BlockXSize="837" BlockYSize="2" />
<SrcRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<DstRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<NODATA>-99</NODATA>
</ComplexSource>
</VRTRasterBand>
<VRTRasterBand dataType="Float32" band="2">
<ColorInterp>A1hr0p3m</ColorInterp>
<NoDataValue>-99</NoDataValue>
<ComplexSource>
<SourceFilename relativeToVRT="1">A20p3m1hr_202305.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="837" RasterYSize="1574" DataType="Float32" BlockXSize="837" BlockYSize="2" />
<SrcRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<DstRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<NODATA>-99</NODATA>
</ComplexSource>
</VRTRasterBand>
<VRTRasterBand dataType="Float32" band="3">
<ColorInterp>A1hr0p5m</ColorInterp>
<NoDataValue>-99</NoDataValue>
<ComplexSource>
<SourceFilename relativeToVRT="1">A30p5m1hr_202305.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="837" RasterYSize="1574" DataType="Float32" BlockXSize="837" BlockYSize="2" />
<SrcRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<DstRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<NODATA>-99</NODATA>
</ComplexSource>
</VRTRasterBand>
<VRTRasterBand dataType="Float32" band="4">
<ColorInterp>A1hr1p0m</ColorInterp>
<NoDataValue>-99</NoDataValue>
<ComplexSource>
<SourceFilename relativeToVRT="1">A41p0m1hr_202305.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="837" RasterYSize="1574" DataType="Float32" BlockXSize="837" BlockYSize="2" />
<SrcRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<DstRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<NODATA>-99</NODATA>
</ComplexSource>
</VRTRasterBand>
<VRTRasterBand dataType="Float32" band="5">
<ColorInterp>A1hr2p0m</ColorInterp>
<NoDataValue>-99</NoDataValue>
<ComplexSource>
<SourceFilename relativeToVRT="1">A52p0m1hr_202305.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="837" RasterYSize="1574" DataType="Float32" BlockXSize="837" BlockYSize="2" />
<SrcRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<DstRect xOff="0" yOff="0" xSize="837" ySize="1574" />
<NODATA>-99</NODATA>
</ComplexSource>
</VRTRasterBand>
</VRTDataset>
```
- 輸入指令轉換vrt成單一圖檔
- gdal_translate merged.vrt merged.tif
# Step3
- 匯入的ingest.template.json內容如下
- bands對應vrt的ColorInterp tag
```
{
"config": {
"service_url": "http://localhost:8080/rasdaman/ows",
"automated": false
},
"input": {
"coverage_id": "Flooding_Vurnerbility_by_Accumulation_Rainfall_All_1hr",
"paths": [
"/home/lung/14_Kaohsung_flood/A_202305.tif"
]
},
"recipe": {
"name": "general_coverage",
"options": {
"coverage": {
"crs": "OGC/0/AnsiDate@EPSG/0/3826",
"metadata": {
"type": "json",
"global": {}
},
"slicer": {
"type": "gdal",
"bands": [
{
"name": "A1hr0p1m",
"identifier": 0
},
{
"name": "A1hr0p3m",
"identifier": 1
},
{
"name": "A1hr0p5m",
"identifier": 2
},
{
"name": "A1hr1p0m",
"identifier": 3
},
{
"name": "A1hr2p0m",
"identifier": 4
}
],
"axes": {
"ansi": {
"gridOrder": 0,
"min": "datetime(regex_extract('${file:name}', '.*?_(\\d\\d\\d\\d\\d\\d).*', 1), 'YYYYMM')",
"type": "ansidate",
"resolution": "1",
"irregular": true,
"dataBound": false
},
"X": {
"gridOrder": 1,
"min": "${gdal:minX}",
"max": "${gdal:maxX}",
"resolution": "${gdal:resolutionX}"
},
"Y": {
"gridOrder": 2,
"min": "${gdal:minY}",
"max": "${gdal:maxY}",
"resolution": "${gdal:resolutionY}"
}
}
}
},
"wms_import": true,
"scale_levels": [
2, 4 ,8, 16, 32, 64, 128, 256
]
}
}
}
```
# Step5
- 直接拿這份json跟合併的tif匯入即可, 之後流程跟一般匯入無異