pik-piam / magclass

R package | Data Class and Tools for Handling Spatial-Temporal Data
GNU Lesser General Public License v3.0
4 stars 24 forks source link

terra-based reading/writing of netcdf files #156

Closed pfuehrlich-pik closed 9 months ago

pfuehrlich-pik commented 1 year ago

The existing read/write support for netcdf based on ncdf4 and raster was not quite working as discussed on mattermost. With this PR nc files are written and read using terra.

The author of raster and terra recommends to not use the netcdf writing feature of raster, see here.

mscrawford commented 1 year ago

In testing this, I wrote a magclass object with 12 subdimensions until 2100. In a .mz format, this was around 36 mb. The write function worked, but produced a 227 mb sized .nc file (which I could interact with in Panoply fine, it seemed). However, this extremely large file breaks the readMagpieNC function (it hangs).

I can do some more tests when I have more time, but are .nc files usually 9x larger than their .mz equivalents? Even the uncompressed (.m) magpie file is only ~50 mb.

pfuehrlich-pik commented 9 months ago

@tscheypidi Please have a look, this may fix the CRAN windows problem. @dklein-pik had the same problem locally