Skip to content

Commit

Permalink
DIMAP: for PNEO products, use the new color interpretations for the N…
Browse files Browse the repository at this point in the history
…IR, RedEdge and DeepBlue/Coastal bands
  • Loading branch information
rouault committed Oct 17, 2024
1 parent c72acef commit 79b446f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autotest/gdrivers/dimap.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ def test_dimap_2_vhr2020_ms_fs():
"Red Edge",
"Deep Blue",
]
assert [ds.GetRasterBand(i + 1).GetColorInterpretation() for i in range(6)] == [
gdal.GCI_RedBand,
gdal.GCI_GreenBand,
gdal.GCI_BlueBand,
gdal.GCI_NIRBand,
gdal.GCI_RedEdgeBand,
gdal.GCI_CoastalBand,
]
rgb_ds = gdal.Open("data/dimap2/vhr2020_ms_fs/MS-FS/IMG_RGB_R1C1.TIF")
ned_ds = gdal.Open("data/dimap2/vhr2020_ms_fs/MS-FS/IMG_NED_R1C1.TIF")
assert ds.ReadRaster() == rgb_ds.ReadRaster() + ned_ds.ReadRaster()
Expand Down
8 changes: 8 additions & 0 deletions frmts/dimap/dimapdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,23 +1400,31 @@ int DIMAPDataset::ReadImageInformation2()
}
case 4:
{
poBand->SetColorInterpretation(GCI_NIRBand);
poBand->SetDescription("NIR");
break;
}
case 5:
{
poBand->SetColorInterpretation(GCI_RedEdgeBand);
poBand->SetDescription("Red Edge");
break;
}
case 6:
{
poBand->SetColorInterpretation(GCI_CoastalBand);
poBand->SetDescription("Deep Blue");
break;
}
default:
break;
}
}
else if (l_nBands == 1 && osSpectralProcessing == "PAN")
{
poBand->SetColorInterpretation(GCI_PanBand);
poBand->SetDescription("Panchromatic");
}
SetBand(iBand, poBand);
}

Expand Down

0 comments on commit 79b446f

Please sign in to comment.