0

I'm brand new in python & gdal (stepping outside of my R-world specifically for this), so if you need anything more to make this reproducible or more clear, please let me know!

I'm trying to extract time series data from several netCDF files WITHOUT having to download the whole files. I know that gdallocationinfo can do so for downloaded .nc files, but /vsicurl/ (which is the only way to access online files in this case) doesn't work together with .nc files.

In the end I'd like to have something like this

gdallocationinfo -wgs84 -valonly "/vsicurl/https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V2/GLOBAL/monthly/cmi/CHELSA_cmi_01_1981_V.2.1.tif" 14.27585 48.9335

that will work for this file: https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V1/chelsa_cmip5_ts/CHELSAcmip5ts_pr_ACCESS1-3_rcp45_2030-2049_V1.1.nc

So I'm looking to find a way to either convince vsicurl to accept the .nc files, or something totally different, whatever works!

Edit
I was first asking for a way to "fix" the line below, but comments from @Robert Davy made it clear that the vsicurl was going to create issues in combination with .nc files, so slightly changed the emphasis of the question.

gdallocationinfo -wgs84 -valonly "/vsicurl/" 14.27585 48.9335
Sanne
  • 3
  • 2

1 Answers1

0

Try

gdallocationinfo -wgs84 -valonly NETCDF:"/vsicurl/https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V1/chelsa_cmip5_ts/CHELSAcmip5ts_pr_ACCESS1-3_rcp45_2030-2049_V1.1.nc":varname 14.27585 48.9335

where varname is the netcdf variable of interest.

However, I think there are some conditions that need to be met for vsicurl and netcdf to work together.

Robert Davy
  • 866
  • 5
  • 13
  • Thanks a lot. Now I get a message that the file is not found, which is more usefull than no message at al :) Also thanks to your comment about `vsicurl` and `netcdf` I've been able to find the page where they discuss that the `netcdf` driver is indeed not available/compatible with `vsicurl`. I guess I have to just accept the fact that I'll have to fully download all files to get the data I need! – Sanne Jul 05 '22 at 07:58