[gdal-dev] vsicurl and --range byte-range

Even Rouault even.rouault at spatialys.com
Thu May 8 15:04:17 PDT 2025


Joaquim,

You can combine /vsisubfile/ 
(https://gdal.org/en/stable/user/virtual_file_systems.html#vsisubfile-portions-of-files) 
and /vsicurl/

/vsisubfile/${offset}_${length}/vsicurl/${url}

e.g.

$ gdalinfo 
/vsisubfile/802533_508958,/vsicurl/https://ecmwf-forecasts.s3.eu-central-1.amazonaws.com/20240301/00z/ifs/0p25/oper/20240301000000-24h-oper-fc.grib2 
--debug on

[...]
Band 1 Block=1440x1 Type=Float64, ColorInterp=Undefined
   Description = 92500[Pa] ISBL="Isobaric surface"
   Metadata:
     GRIB_UNIT=[%]
     GRIB_COMMENT=Relative humidity [%]
     GRIB_ELEMENT=RH
     GRIB_SHORT_NAME=92500-ISBL
     GRIB_REF_TIME=1709251200
     GRIB_VALID_TIME=1709337600
     GRIB_FORECAST_SECONDS=86400
     GRIB_DISCIPLINE=0(Meteorological)
     GRIB_IDS=CENTER=98(ECMWF) SUBCENTER=0 MASTER_TABLE=27 LOCAL_TABLE=0 
SIGNF_REF_TIME=1(Start_of_Forecast) REF_TIME=2024-03-01T00:00:00Z 
PROD_STATUS=0(Operational) TYPE=1(Forecast)
     GRIB_PDS_PDTN=0
     GRIB_PDS_TEMPLATE_NUMBERS=1 1 2 255 154 0 0 0 1 0 0 0 24 100 0 0 1 
105 84 255 255 255 255 255 255
     GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES=1 1 2 255 154 0 0 1 24 100 0 
92500 255 -127 -2147483647

Even

Le 08/05/2025 à 23:48, Joaquim Manuel Freire Luís via gdal-dev a écrit :
>
> Hi,
>
> I’m writing a tool to download ECMWF forecast data in gring2 format. 
> But since those files have > 150 bands and most of times I’m only 
> interested in a couple of them, I’m using the only documented 
> mechanism that I found [1], which is the “curl –range start-stop”. 
> That works fine but what I would really like is to be able to use
>
> gdal_translate /vsicurl/…
>
> because then I should be able to save the result directly in netCDF 
> and even get only a sub-region. But I’m not able to find a way to use 
> both /vsicurl/ and a (equivalent) –range option. Is that possible and 
> I didn’t find how to, or we simple cannot do it?
>
> Thanks
>
> Joaquim
>
> [1] 
> https://confluence.ecmwf.int/display/DAC/ECMWF+open+data%3A+real-time+forecasts+from+IFS+and+AIFS#ECMWFopendata:realtimeforecastsfromIFSandAIFS-DownloadASingleFieldWithWget
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250509/2adc775a/attachment-0001.htm>


More information about the gdal-dev mailing list