Opening ncml files similarly to loadeR in R
RSO9192 opened this issue · 2 comments
RSO9192 commented
Description
We currently developed a library that streamlines access and processing of CORDEX-CORE models (among other things).
We would like to make this data available to the Python community as well.
In R, the loadR package allows you to easily read and open ncml files. Below is an example that you can reproduce if you install loadeR.
library(loadeR)
url_ncml = "https://data.meteo.unican.es/thredds/dodsC/fao/interp025/aggregations/CORDEX/output/AFR-22/GERICS/MOHC-HadGEM2-ES/historical/r1i1p1/REMO2015/v1/day/CORDEX_output_AFR-22_GERICS_MOHC-HadGEM2-ES_historical_r1i1p1_REMO2015_v1_day.ncml"
data = loadGridData(dataset = url_ncml, var = "pr", season = 1:12, years = 1980, lonLim = c(0,5), latLim = c(0,5))
Is there anything equivalent to this in Python? I understand xncml would open ncml files but only if the netCDF files are locally available unless I got this wrong.
Any suggestions are greatly appreciated!
huard commented
Sorry I missed this.
If the ncml is hosted on a THREDDS server, you'll be able to open it using xarray directly, no need for xncml.
import xarray as xr
ds = xr.open_dataset(url_ncml)
RSO9192 commented
That's great, thank you David!