1

I downloaded h5 VIIRS file by CLASS NOOA website.

In particular I am interested in Snow Cover Binary Maps EDR and I need to reproject them in lat/lon or UTM.

I tried to use gdal warp to this aim but, although I get correct latitude, I get completely wrong longitude (for example in my AOI I got 170 degrees instead of 10 degrees E), when I open tif file using qgis or envi

Using gdalinfo I get the names of the subdatasets. In particular one of them is the subdataset:

SUBDATASET_16_NAME=HDF5:"GITCO-VSCMO_npp_d20150102_t1051499_e1057303_b16487_c20160728125230331648_noaa_ops.h5"://All_Data/VIIRS-SCD-BINARY-SNOW-MAP-EDR_All/SnowCoverBinaryMap
SUBDATASET_16_DESC=[6144x6400]//All_Data/VIIRS-SCD-BINARY-SNOW-MAP-EDR_All/SnowCoverBinaryMap (8-bit unsigned character)

consequently the commmand line I tried is the following:

gdalwarp -t_srs 'epsg:4326' HDF5:"GITCO-VSCMO_npp_d20141212_t1043482_e1049286_b16189_c20160530182604182662_noaa_ops.h5"://All_Data/VIIRS-SCD-BINARY-SNOW-MAP-EDR_All/SnowCoverBinaryMap rip.tif 

I also tried to insert -s_srs 'epsg:4326' but the result is the same.

Do you have any suggestion, please?

AndreJ
  • 76,698
  • 5
  • 86
  • 162
  • Can you give a detailed link where to download the VIIRS file you work on? – AndreJ Aug 01 '16 at 14:08
  • Yes sure.

    I use CLASS Website:

    [link] (http://www.class.ncdc.noaa.gov/saa/products/welcome;jsessionid=89155AFA9DA18DC35CFDC398D42A4E22)

    select: JPSS Visible Infrared Imaging Radiometer Suite Environmental Data Record (VIIR_EDR)

    and then check in:

    VIIRS Snow Cover/Depth Binary Map EDR (VSCMO)

    – GiovanniCuozzo Aug 02 '16 at 14:36

1 Answers1

1

Similar to Unable to warp HDF5 files, the hdf geolocation seems to be interpreted wrong by GDAL. If you extract the subdataset as a vrt file, it has GCP points inside, but they are above 180° longitude, and a shift of 180° does not fit. Subdatasets 2 and 3 contain latitudes and longitudes with reasonable values.

So I took the same workaround as given in the linked question, building a vrt file manually around the dataset:

<VRTDataset rasterXSize="6400" rasterYSize="6144">
  <Metadata domain="GEOLOCATION">
    <MDI key="LINE_OFFSET">0</MDI>
    <MDI key="LINE_STEP">1</MDI>
    <MDI key="PIXEL_OFFSET">0</MDI>
    <MDI key="PIXEL_STEP">1</MDI>
    <MDI key="X_BAND">1</MDI>
    <MDI key="X_DATASET">HDF5:"gitco.h5"://All_Data/VIIRS-IMG-GEO-TC_All/Longitude</MDI>
    <MDI key="Y_BAND">1</MDI>
    <MDI key="Y_DATASET">HDF5:"gitco.h5"://All_Data/VIIRS-IMG-GEO-TC_All/Latitude</MDI>
  </Metadata>
  <VRTRasterBand dataType="Byte" band="1">
    <SimpleSource>
      <SourceFilename relativeToVRT="1">HDF5:"gitco.h5"://All_Data/VIIRS-SCD-BINARY-SNOW-MAP-EDR_All/SnowCoverBinaryMap</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="6400" RasterYSize="6144" DataType="Byte" BlockXSize="6400" BlockYSize="1" />
      <SrcRect xOff="0" yOff="0" xSize="6400" ySize="6144" />
      <DstRect xOff="0" yOff="0" xSize="6400" ySize="6144" />
    </SimpleSource>
  </VRTRasterBand>

and running gdalwarp without the use of the wrong GCP:

gdalwarp -geoloc -t_srs EPSG:4326 gitco.vrt gitco_16_warped.tif -overwrite -dstnodata 50

The result covers most of Europe:

enter image description here

I have applied a -dstnodata value of 50, because the data is mostly around 0 and 255.

AndreJ
  • 76,698
  • 5
  • 86
  • 162
  • Thank you! It seems to solve the problem. I still have only one question. Do you think that the deletion of GCP could affect the geographic accuracy locally? – GiovanniCuozzo Aug 04 '16 at 09:45
  • The GCP are built from the subdatasets 2 and 3, but shifted by 180° of Longitude. 3000 points are taken, but only the upper left corner is included (which appears lower right in EPSG:4326). The other corners are extrapolated from the last nearby GCP, which is rather inaccurate. Using the vrt seems to solve that probem (and the 180° shift). – AndreJ Aug 05 '16 at 07:18
  • Is this bow-tie effect in the image. How do you fix it? – Leonidas Nov 03 '18 at 18:41
  • @LeonidasLiakos the bended edges come from the satellites view. You can not change it. – AndreJ Nov 03 '18 at 20:15
  • @AndreJ I talk about green pixels inside image not the edges – Leonidas Nov 04 '18 at 16:07
  • @LeonidasLiakos it might help to specify the correct source nodata value. – AndreJ Nov 04 '18 at 19:49
  • @AndreJ Do you mean to specify -dstnodata? It's better to fill the values with an interpolation method, isn't it? – Leonidas Nov 05 '18 at 06:34
  • No, -srcnodata. Otherwise GDAL interpolates between the unrecognized nodata value and real values. – AndreJ Nov 05 '18 at 06:40
  • @AndreJ So if you need interpolation you omit -srcnodata. Right? – Leonidas Nov 05 '18 at 18:11
  • @LeonidasLiakos Interpolation between nodata and real data never makes sense. – AndreJ Nov 05 '18 at 19:31