downscaleCMIP6 icon indicating copy to clipboard operation
downscaleCMIP6 copied to clipboard

How to access the data using R?

Open Freestyleyang opened this issue 2 years ago • 1 comments

Hi there, Thank you for developing the downscaled CMIP6 dataset! Is it possible to access the data using R? Could you please share some example codes?

Freestyleyang avatar Jul 29 '22 15:07 Freestyleyang

Thanks for your question and interest!

Unfortunately, this looks like it's still tricky. zarr support for R is being worked on, but it looks like it's in it's early stages. See this issue on zarr-developers: https://github.com/zarr-developers/community/issues/18

There is an example of reading from the STAC collection with R here: https://github.com/microsoft/PlanetaryComputerExamples/blob/main/quickstarts/reading-stac-r.ipynb

One thing you could do is to download a subset of the data in python, save to netCDF or something with better R support, and then open it locally in R. You could read in the data with xarray as we show in the examples and then save to netcdf with xr.Dataset.to_netcdf, e.g.:

ds.to_netcdf("local_filepath.nc")

The access to the data is provided by https://github.com/microsoft/PlanetaryComputer, so that's a good place to go for general access & support questions.

delgadom avatar Aug 02 '22 18:08 delgadom