MagicForrest / DGVMTools

R package for processing, analysing and visualising ouput from Dynamic Global Vegetation Models (DGVMs)
GNU General Public License v3.0
26 stars 22 forks source link

writeNetCDF: (Option to) save entire Earth #67

Closed samsrabin closed 3 years ago

samsrabin commented 3 years ago

As it is now, it seems that writeNetCDF only saves to its Lon and Lat variables values that are actually included somewhere in the dataset. This typically means that, even for a "global" DGVM run, the poles and Atlantic Ocean are excluded. While this might make sense from a space-saving perspective, it makes it difficult to work with the output files in other programs. Ideally, it would be possible to tell writeNetCDF to save a global map, filling unused space with the missing value.

Here is one such file as an example. When I import this into MATLAB, I get an array of size 277 lat, 695 lon. I thus have to do extra work to make it align with data from files that are actually global in extent.

MagicForrest commented 3 years ago

Hi Sam. Good points you make there. It should be possible to fill in the Atlantic, I recently adjusted that. Try the branch Format-NetCDF, it should automatically fills gaps in Lon and Lat when writing netCDFs.

As for truly "going global" that is something I should work on. It wouldn't be too hard to expand the Lon and Lats to the globe. I'll consider that an open issue that I should address in the next release.

MagicForrest commented 3 years ago

Implemented in branch "Format-NetCDF" for testing. Should be included in release v0.10.