Hi, The attached python script that reads from a vendor’s SPOT6 distribution archive and creates a cloud optimized geotiff. Reading and writing works, but the band description does not take properly.
Problem 1: The greek letter Mu or Micron<https://theasciicode.com.ar/extended-ascii-code/lowercase-letter-mu-micro-sign-micron-ascii-code-230.html> in description is converted to something else. In: Near-Infrared (0.760 µm – 0.890 µm) Gdalinfo: Near-Infrared (0.760 ┬╡m ΓÇô 0.890 ┬╡m) I’m quite sure I’ve seen geotiff descriptions using the micron character before. It was seeing someone else do that the gave me the idea to do the same with our data. Maybe they weren’t using gdal though? Problem 2: on close it’s trying to update the source. This fails because the source is zipped, which is good because we want to leave the source untouched. However I don’t want to rely on this to keep our house in order. What is the proper way to do this? Example script run: $ spot-zip-to-preview process-list-sample.csv preview 2048 /vsizip/A:\Imagery\Work\SPOT-raw\DS_SPOT6_202008182031259_LM1_LM1_LM1_LM1_W137N63_01790.zip/DS_SPOT6_202008182031259_LM1_LM1_LM1_LM1_W137N63_01790/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_MS_001_A/DIM_SPOT6_MS_202008182031259_SEN_1.XML 0.10..20...50..81..100Warning 6: driver COG does not support creation option PHOTOMETRIC Warning 1: Unable to save auxiliary information in /vsizip/A:\Imagery\Work\SPOT-raw\DS_SPOT6_202008182031259_LM1_LM1_LM1_LM1_W137N63_01790.zip/DS_SPOT6_202008182031259_LM1_LM1_LM1_LM1_W137N63_01790/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_MS_001_A/DIM_SPOT6_MS_202008182031259_SEN_1.XML.aux.xml. The relevant part of the script: data_in = gdal.Open(vsipath) #print(data_in.GetMetadata()) if "_MS_" in ds: data_in.GetRasterBand(1).SetColorInterpretation(gdal.GCI_RedBand) data_in.GetRasterBand(1).SetDescription("Red (0.625 µm – 0.695 µm)") data_in.GetRasterBand(2).SetColorInterpretation(gdal.GCI_GreenBand) data_in.GetRasterBand(2).SetDescription("Green (0.530 µm – 0.590 µm)") data_in.GetRasterBand(3).SetColorInterpretation(gdal.GCI_BlueBand) data_in.GetRasterBand(3).SetDescription("Blue (0.455 µm – 0.525 µm)") #data_in.GetRasterBand(4).SetColorInterpretation("Gray") data_in.GetRasterBand(3).SetDescription("Near-Infrared (0.760 µm – 0.890 µm)") if "_P_" in ds: #data_in.GetRasterBand(1).SetColorInterpretation("Gray") data_in.GetRasterBand(1).SetDescription("Panchromatic") gdal.Translate(dstname, vsipath, width=w, height=h, format="COG", noData=0, creationOptions=options, callback=progress_cb, callback_data='.') Thanks in advance for your thoughts. Matt Wilkie Geomatics Developer & Administrator Environment | Technology, Innovation and Mapping T 867-667-8133 | Yukon.ca<http://yukon.ca/> Hours: 08:30-16:30, Mon-Wed: Office, Thu: Remote, Fri: Away.
<<attachment: SPOT-zip-to-preview.zip>>
Driver: GTiff/GeoTIFF Files: preview\DS_SPOT6_202008182031259_LM1_LM1_LM1_LM1_W137N63_01790_A_16bit.tif Size is 2048, 2009 Metadata: BAND_MODE=PMS CLOUDCOVER_MEASURE_DESC=Region of interest mask CLOUDCOVER_MEASURE_NAME=Area_Of_Interest (ROI) CLOUDCOVER_MEASURE_TYPE=AUTOMATIC CLOUDCOVER_QUALITY_TABLES=SPOT DATASET_DELIVERY_TYPE=NETWORK DATASET_JOB_ID=_1 DATASET_PRODUCER_ADDRESS=Order Desk, PO Box 21038 Westview, Lethbridge Alberta, T1K6X4 - Canada DATASET_PRODUCER_CONTACT=geomatics-sa...@planet.com DATASET_PRODUCER_NAME=PLANET LABS GEOMATICS CORP DATASET_PRODUCTION_DATE=2021-03-08T19:03:04.00Z DATASET_PRODUCT_INFO=SPOT DATASET_PRODUCT_TYPE=NA EPHEMERIS_ACQUISITION_ORBIT_DIRECTION=DESCENDING EPHEMERIS_ACQUISITION_ORBIT_NUMBER=372 EPHEMERIS_NADIR_LAT=6.3364908090553250e+01 EPHEMERIS_NADIR_LON=-1.4142964751935833e+02 FACILITY_PROCESSING_CENTER=DRS FACILITY_SOFTWARE=IMF GEOMETRIC_ATTITUDES_USED=CORRECTED GEOMETRIC_EPHEMERIS_USED=CORRECTED GEOMETRIC_GEOMETRIC_PROCESSING=SENSOR GEOMETRIC_GROUND_SETTING=false GEOMETRIC_VERTICAL_SETTING=false IMAGING_DATE=2020-08-18 IMAGING_TIME=20:31:25.9 INSTRUMENT=SPOT INSTRUMENT_INDEX=6 MISSION=SPOT MISSION_INDEX=6 PROCESSING_LEVEL=SENSOR SPECTRAL_PROCESSING=MS Image Structure Metadata: COMPRESSION=ZSTD INTERLEAVE=PIXEL LAYOUT=COG RPC Metadata: HEIGHT_OFF=733.005 HEIGHT_SCALE=198.5 LAT_OFF=63.47841961 LAT_SCALE=0.08141634 LINE_DEN_COEFF=1 -6.31710025626589e-10 9.28731965490496e-10 1.59192829046089e-11 -5.70050726941095e-09 9.08080140226998e-12 1.54765000335889e-10 -2.7984199093652e-12 8.31220369759856e-09 -8.51265131982361e-13 -2.41639854356349e-11 -5.42315554850746e-11 1.19053085831149e-09 1.5687078530531e-14 8.86653413828049e-10 -1.73795579431899e-09 -2.32679132842458e-14 1.5126821229747e-12 -3.02643106305099e-11 4.84777159259441e-16 LINE_NUM_COEFF=0.000978214554070806 0.0100406858253757 -1.01035833628811 -0.0002992175535402 0.000495467099218108 5.23626006660564e-07 -3.70871671103164e-05 -0.00155354829290947 4.33099374183395e-05 -1.69144846055175e-09 3.8095561909985e-08 7.85514925641852e-07 -1.62053568636707e-06 8.93211413950082e-12 4.47982248187143e-06 1.46935772200574e-05 -2.39608801724809e-10 -5.71856275173032e-08 -4.37650480016862e-08 -4.00556397625548e-14 LINE_OFF=1003.76571637427 LINE_SCALE=1004.5 LONG_OFF=-137.90390432 LONG_SCALE=0.18968415 SAMP_DEN_COEFF=1 2.76117301204937e-08 -2.82488869033771e-09 -4.64998145114664e-09 -3.45566888600942e-07 6.16405139590997e-09 5.28765197697414e-08 1.06624816722523e-08 8.68097341114936e-08 -5.80459771748613e-10 -1.32348618756257e-09 -5.08510767009727e-10 -2.50276247149414e-09 1.50796853468106e-11 8.34752336506997e-09 1.47404641834003e-09 -1.3718025263772e-11 -1.26229715336456e-10 6.66072711594986e-10 -4.54694901054551e-13 SAMP_NUM_COEFF=0.00482569162160558 1.00778418740191 -0.00193508538141738 0.00591843427257711 -0.000218168433608379 0.000271395697495368 -9.93623603404572e-05 -0.00413045743527306 -0.000306302106422484 1.50413121972373e-06 1.64123613392157e-06 8.38346756292879e-06 -2.94868066494464e-05 6.3632494489105e-08 7.18023765518477e-05 1.704025527102e-05 -2.49588408603375e-08 -2.44085124116317e-06 -3.79764469437817e-07 3.87817270756256e-10 SAMP_OFF=1023.26568662603 SAMP_SCALE=1024 Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 2009.0) Upper Right ( 2048.0, 0.0) Lower Right ( 2048.0, 2009.0) Center ( 1024.0, 1004.5) Band 1 Block=512x512 Type=UInt16, ColorInterp=Red Description = Red (0.625 µm â 0.695 µm) NoData Value=0 Overviews: 1024x1005, 512x503 Metadata: RADIANCE_BIAS=22.887443996318712 RADIANCE_CALIBRATION_DATE=2021-03-08T19:04:05Z RADIANCE_GAIN=0.003198417756009923 RADIANCE_MEASURE_DESC=Reflectance (RHO) to TOA Radiance (L). Formulae L=RHO/GAIN+BIAS RADIANCE_MEASURE_UNCERTAINTY=5 RADIANCE_MEASURE_UNIT=watt/m2/steradians/micrometers SOLAR_IRRADIANCE_CALIBRATION_DATE=2011-09-20T12:00:00Z SOLAR_IRRADIANCE_MEASURE_DESC=Solar irradiance value of raw radiometric Band SOLAR_IRRADIANCE_MEASURE_UNCERTAINTY=8.131208051 SOLAR_IRRADIANCE_MEASURE_UNIT=watt/m2/micron SOLAR_IRRADIANCE_VALUE=1982.671954 SPECTRAL_RANGE_CALIBRATION_DATE=2011-09-19T12:00:00Z SPECTRAL_RANGE_MAX=522 SPECTRAL_RANGE_MEASURE_DESC=Spectral Range values of raw radiometric Band SPECTRAL_RANGE_MEASURE_UNCERTAINTY=0.005 SPECTRAL_RANGE_MEASURE_UNIT=nanometers SPECTRAL_RANGE_MIN=451 Band 2 Block=512x512 Type=UInt16, ColorInterp=Green Description = Green (0.530 µm â 0.590 µm) NoData Value=0 Overviews: 1024x1005, 512x503 Metadata: RADIANCE_BIAS=11.396535985667427 RADIANCE_CALIBRATION_DATE=2021-03-08T19:04:05Z RADIANCE_GAIN=0.0033596671204471776 RADIANCE_MEASURE_DESC=Reflectance (RHO) to TOA Radiance (L). Formulae L=RHO/GAIN+BIAS RADIANCE_MEASURE_UNCERTAINTY=4 RADIANCE_MEASURE_UNIT=watt/m2/steradians/micrometers SOLAR_IRRADIANCE_CALIBRATION_DATE=2011-09-20T12:00:00Z SOLAR_IRRADIANCE_MEASURE_DESC=Solar irradiance value of raw radiometric Band SOLAR_IRRADIANCE_MEASURE_UNCERTAINTY=3.511361012 SOLAR_IRRADIANCE_MEASURE_UNIT=watt/m2/micron SOLAR_IRRADIANCE_VALUE=1826.087443 SPECTRAL_RANGE_CALIBRATION_DATE=2011-09-19T12:00:00Z SPECTRAL_RANGE_MAX=591 SPECTRAL_RANGE_MEASURE_DESC=Spectral Range values of raw radiometric Band SPECTRAL_RANGE_MEASURE_UNCERTAINTY=0.006 SPECTRAL_RANGE_MEASURE_UNIT=nanometers SPECTRAL_RANGE_MIN=524 Band 3 Block=512x512 Type=UInt16, ColorInterp=Blue Description = Near-Infrared (0.760 µm â 0.890 µm) NoData Value=0 Overviews: 1024x1005, 512x503 Metadata: RADIANCE_BIAS=5.071787888125989 RADIANCE_CALIBRATION_DATE=2021-03-08T19:04:05Z RADIANCE_GAIN=0.0037841024210951263 RADIANCE_MEASURE_DESC=Reflectance (RHO) to TOA Radiance (L). Formulae L=RHO/GAIN+BIAS RADIANCE_MEASURE_UNCERTAINTY=3 RADIANCE_MEASURE_UNIT=watt/m2/steradians/micrometers SOLAR_IRRADIANCE_CALIBRATION_DATE=2011-09-20T12:00:00Z SOLAR_IRRADIANCE_MEASURE_DESC=Solar irradiance value of raw radiometric Band SOLAR_IRRADIANCE_MEASURE_UNCERTAINTY=7.914946555 SOLAR_IRRADIANCE_MEASURE_UNIT=watt/m2/micron SOLAR_IRRADIANCE_VALUE=1540.494123 SPECTRAL_RANGE_CALIBRATION_DATE=2011-09-19T12:00:00Z SPECTRAL_RANGE_MAX=698 SPECTRAL_RANGE_MEASURE_DESC=Spectral Range values of raw radiometric Band SPECTRAL_RANGE_MEASURE_UNCERTAINTY=0.008 SPECTRAL_RANGE_MEASURE_UNIT=nanometers SPECTRAL_RANGE_MIN=621 Band 4 Block=512x512 Type=UInt16, ColorInterp=Undefined NoData Value=0 Overviews: 1024x1005, 512x503 Metadata: RADIANCE_BIAS=1.4859370114539538 RADIANCE_CALIBRATION_DATE=2021-03-08T19:04:05Z RADIANCE_GAIN=0.005343199180434007 RADIANCE_MEASURE_DESC=Reflectance (RHO) to TOA Radiance (L). Formulae L=RHO/GAIN+BIAS RADIANCE_MEASURE_UNCERTAINTY=4 RADIANCE_MEASURE_UNIT=watt/m2/steradians/micrometers SOLAR_IRRADIANCE_CALIBRATION_DATE=2011-09-20T12:00:00Z SOLAR_IRRADIANCE_MEASURE_DESC=Solar irradiance value of raw radiometric Band SOLAR_IRRADIANCE_MEASURE_UNCERTAINTY=9.091714992 SOLAR_IRRADIANCE_MEASURE_UNIT=watt/m2/micron SOLAR_IRRADIANCE_VALUE=1094.747446 SPECTRAL_RANGE_CALIBRATION_DATE=2011-09-19T12:00:00Z SPECTRAL_RANGE_MAX=885 SPECTRAL_RANGE_MEASURE_DESC=Spectral Range values of raw radiometric Band SPECTRAL_RANGE_MEASURE_UNCERTAINTY=0.009 SPECTRAL_RANGE_MEASURE_UNIT=nanometers SPECTRAL_RANGE_MIN=752
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev