Integration of units package
RNetCDF has limited integration with udunits2 for conversion of time units in netcdf attributes. Other R packages now provide interfaces to udunits2, such as https://cran.r-project.org/web/packages/units/index.html . The RNetCDF installation process could be simplified by replacing direct links to the udunits2 library with R functions from the "units" package.
RNetCDF support for a wide range of units could be added via integration with the "units" package (or similar).
Any volunteers?
I removed the "help wanted" label for now. Current work on netcdf4 involves a major rewrite of existing RNetCDF code, so development of unrelated features may not be practical at this time.
I'm volunteering - let me know when is a good time.
Thanks @edzer . I will let you know. It's a pity you can't start straight away, but I really think it would waste your time right now.
Is this idea still current?
Hi @edzer , sorry for the delayed response - your comment dropped off my radar until I checked just now.
My main motivation for using the units package was to remove the need for RNetCDF to be linked with udunits2. In recent RNetCDF versions, I have made udunits2 an optional dependency, and the calendar functions are simply disabled if udunits2 is not detected. Even so, if the units package now provides access to the full udunits2 API, I would still be interested in using it.
Beyond calendar functions, I'm no longer sure about the benefits of deeper integration of the units package with RNetCDF. How would this make things more convenient for users, and would it be worth the added complexity in our packages?
Cc: @Enchufa2 - About the benefits: see here: Using units may eliminate a whole class of potential scientific programming mistakes. If NetCDF files come with units, why would an R user want to ignore them? Why would an R developer decide users of an NetCDF-reading package will not need them?
In two spatial packages I maintain (sf and stars) we enforce them on the user: if you compute a distance, when possible (CRS is known) the distance you get back has the proper unit: ft, m, km, whatever. Users can decide to ignore that, but it is not as if they weren't informed.
As discussed in #50 we haven't split units in a udunits2 API and a user-level package - I'd be open to that, but this may be quite a bit of effort. If RNetCDF would use units as a conditional dependency (in Suggests:), it would free you from the questions how to get RNetCDF running with udunits2 support when the udunits2 SysReq is not installed.