0

I have a grib2 file which you can download here that contains radar rain data. (1.3MB, just one band). I am trying to convert it to TIF so I can colorize it and reproject it to EPSG:3857.

The .tif is generated with my commands below but the image is completely black. I have tried so many commands over the past several hours that it would be pointless to clutter this question with them all. Using gdalinfo, I see the file has one band. Here is my code :

gdal_translate -b 1 MRMS_MergedReflectivityQCComposite_00.50_20200527-094830.grib2 output.tif

The .tif output generated from that command is 191MB but completely black. I opened it in QGIS and its black there too. I tried colorizing it using gdaldem (because why not try? and it was still completely black after. What am I doing wrong? (In case anyone is able to help and wants to go all the way, this is the colorization file for gdaldem )

Here is the gdalinfo output :

Driver: GRIB/GRIdded Binary (.grb, .grb2)
Files: MRMS_MergedReflectivityQCComposite_00.50_20200527-094830.grib2
Size is 7000, 3500
Coordinate System is:
GEOGCRS["Coordinate System imported from GRIB file",
    DATUM["unnamed",
        ELLIPSOID["Spheroid imported from GRIB file",6378160,298.253916296469,
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433,
            ID["EPSG",9122]]],
    CS[ellipsoidal,2],
        AXIS["latitude",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]],
        AXIS["longitude",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]]]
Data axis to CRS axis mapping: 2,1
PROJ.4 string is:
'+proj=longlat +a=6378160 +rf=298.253916296469 +no_defs'
Origin = (-129.999999999857124,54.999999999857103)
Pixel Size = (0.009999999714245,-0.009999999714204)
Corner Coordinates:
Upper Left  (-130.0000000,  55.0000000) (130d 0' 0.00"W, 55d 0' 0.00"N)
Lower Left  (-130.0000000,  20.0000010) (130d 0' 0.00"W, 20d 0' 0.00"N)
Upper Right ( -60.0000020,  55.0000000) ( 60d 0' 0.01"W, 55d 0' 0.00"N)
Lower Right ( -60.0000020,  20.0000010) ( 60d 0' 0.01"W, 20d 0' 0.00"N)
Center      ( -95.0000010,  37.5000005) ( 95d 0' 0.00"W, 37d30' 0.00"N)
Band 1 Block=7000x1 Type=Float64, ColorInterp=Undefined
  Description = 500[m] GPML="Specific altitude above mean sea level"
  Metadata:
    GRIB_COMMENT=Composite Reflectivity Mosaic (optimal method) [dBZ]
    GRIB_DISCIPLINE=209
    GRIB_ELEMENT=MergedReflectivityQCComposite
    GRIB_FORECAST_SECONDS=0 sec
    GRIB_IDS=CENTER=161(US-OAR) SUBCENTER=0 MASTER_TABLE=255 LOCAL_TABLE=1 SIGNF_REF_TIME=3(Observation_time) REF_TIME=2020-05-27T09:48:30Z PROD_STATUS=2(Research) TYPE=7(Processed_radar_observations)
    GRIB_PDS_PDTN=0
    GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES=10 0 8 0 97 0 0 0 0 102 0 500 255 1 0
    GRIB_PDS_TEMPLATE_NUMBERS=10 0 8 0 97 0 0 0 0 0 0 0 0 102 0 0 0 1 244 255 1 0 0 0 0
    GRIB_REF_TIME=  1590572910 sec UTC
    GRIB_SHORT_NAME=500-GPML
    GRIB_UNIT=[dBZ]
    GRIB_VALID_TIME=  1590572910 sec UTC

PS - I saw another question here that was similar but it was for a different output format (KMZ) and the answer did not help with this issue.

EDIT : This is gdalinfo ran with -stats as suggested any another user :

Driver: GTiff/GeoTIFF
Files: out.tif
Size is 7000, 3500
Coordinate System is:
GEOGCRS["Coordinate System imported from GRIB file",
    DATUM["unnamed",
        ELLIPSOID["Spheroid imported from GRIB file",6378160,298.253916296469,
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433,
            ID["EPSG",9122]]],
    CS[ellipsoidal,2],
        AXIS["latitude",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]],
        AXIS["longitude",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]]]
Data axis to CRS axis mapping: 2,1
Origin = (-129.999999999857124,54.999999999857103)
Pixel Size = (0.009999999714245,-0.009999999714204)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-130.0000000,  55.0000000) (130d 0' 0.00"W, 55d 0' 0.00"N)
Lower Left  (-130.0000000,  20.0000010) (130d 0' 0.00"W, 20d 0' 0.00"N)
Upper Right ( -60.0000020,  55.0000000) ( 60d 0' 0.01"W, 55d 0' 0.00"N)
Lower Right ( -60.0000020,  20.0000010) ( 60d 0' 0.01"W, 20d 0' 0.00"N)
Center      ( -95.0000010,  37.5000005) ( 95d 0' 0.00"W, 37d30' 0.00"N)
Band 1 Block=7000x1 Type=Float32, ColorInterp=Gray
  Description = 500[m] GPML="Specific altitude above mean sea level"
  Minimum=-999.000, Maximum=-999.000, Mean=-999.000, StdDev=0.000
  Metadata:
    GRIB_COMMENT=Composite Reflectivity Mosaic (optimal method) [dBZ]
    GRIB_DISCIPLINE=209
    GRIB_ELEMENT=MergedReflectivityQCComposite
    GRIB_FORECAST_SECONDS=0 sec
    GRIB_IDS=CENTER=161(US-OAR) SUBCENTER=0 MASTER_TABLE=255 LOCAL_TABLE=1 SIGNF_REF_TIME=3(Observation_time) REF_TIME=2020-05-27T09:48:30Z PROD_STATUS=2(Research) TYPE=7(Processed_radar_observations)
    GRIB_PDS_PDTN=0
    GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES=10 0 8 0 97 0 0 0 0 102 0 500 255 1 0
    GRIB_PDS_TEMPLATE_NUMBERS=10 0 8 0 97 0 0 0 0 0 0 0 0 102 0 0 0 1 244 255 1 0 0 0 0
    GRIB_REF_TIME=1590572910 sec UTC
    GRIB_SHORT_NAME=500-GPML
    GRIB_UNIT=[dBZ]
    GRIB_VALID_TIME=1590572910 sec UTC
    STATISTICS_MAXIMUM=-999
    STATISTICS_MEAN=-999
    STATISTICS_MINIMUM=-999
    STATISTICS_STDDEV=0
    STATISTICS_VALID_PERCENT=100
  • Run gdalinfo with statistics gdalinfo output.tif -stats or with histogram gdalinfo output.tif -hist. It may be that you have all data near the black end of the full range of Float64. – user30184 May 27 at 19:10
  • I have edited my answer and added those stats to the bottom, I am just not experienced to know what it means exactly. – David May 27 at 20:55
1

Works for me with GDAL 3.1.0, your data, and command

gdal_translate -b 1 MRMS_MergedReflectivityQCComposite_00.50_20200527-094830.grib2 output.tif

For some reason you got an output image with just -999 values in all pixels. Min=-999 and Max=-999 means that. In my output.tif the statistics show these values

STATISTICS_MAXIMUM=60
STATISTICS_MEAN=-424.3709117755
STATISTICS_MINIMUM=-999
STATISTICS_STDDEV=437.55555071939
STATISTICS_VALID_PERCENT=100

The output.tif in QGIS. Notise that Min-Max values for contrast enhancement in Layer properties - Symbology must be set if QGIS does not do it automatically. Usually it does.

enter image description here

You must make the conversion into GeoTIFF work so that the pixel values remain. Try again by removing all output files that you have now, including .aux.xml files if you have such. If the result it still just all -999 then the problem must be in your GDAL version.

| improve this answer | |
  • This worked. Thank you - all I did was update GDAL as you requested. It's weird that I was on the latest version up until 9 days ago and it did not work. I am curious if they fixed a bug or what could have caused it, but it's working now. – David May 28 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.