I am working with a GeoTIFF file from the Earth Observation Group (3rd download on this page). Once extracted, the file is too large (5.6gb) to do much with on my laptop - so I am trying to downsample it with rasterio (Python) and will then want to mask to specific regions/countries.

However, following a PyGIS resampling tutorial is throwing up some odd results. The code below is creating a plot of a stange image (attached) showing bands of colours but no nightlights. Any ideas what I'm doing wrong?

plot of yellow blue and green horizontal bands

import rasterio
from rasterio.enums import Resampling
import numpy as np
from rasterio.plot import show, adjust_band
with rasterio.open('VNL_v2_npp_2019_global_vcmslcfg_c202101211500.cvg.tif') as dataset:
    data = dataset.read(
            int(dataset.height * downscale_factor),
            int(dataset.width * downscale_factor)
    dst_transform = dataset.transform * dataset.transform.scale(
        (dataset.width / data.shape[-1]),
        (dataset.height / data.shape[-2])

1 Answer 1


The answer was that I had downloaded the wrong file.

The 'cvg' file appears to be a coverage grid that tallies the number of observations during the year (that were free of straylight etc.).

The 'average' file (1st download on link above, rather than 3rd) holds actual night light imagery - and can be downsampled successfully with above code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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