ropensci / tidync

NetCDF exploration and data extraction
https://docs.ropensci.org/tidync
90 stars 12 forks source link

Enable grid activation by using a variable name as a string #112

Closed aodenweller closed 2 years ago

aodenweller commented 2 years ago

Description

This pull request enables to pass a variable name as a string in order to activate the respective grid. It first tries to simply match what_name with what, which works if what is provided as a string. If this throws an error it executes the usual deparse(substitute(what)) as before.

Related Issue

This fixes #95

Example

Try it out for any NetCDF file, where the variable you're trying to get is defined on a grid that is not activated by default.

aodenweller commented 2 years ago

I just realised now that this might introduce other issues. I'll check again tomorrow.

mdsumner commented 2 years ago

awesome thank you, I'm just doing some updates to fix the CI testing in another branch and will get to this soon

mdsumner commented 2 years ago

I merged this in manually

(I'm still confused about what did and didn't work before, but I'll try to get to a closer look)

aodenweller commented 2 years ago

Now in netcdf-with-tidync.Rmd, for some reason tidync(ice_file) >%> activate(time) doesn't work any longer I think. Now you need to quote it using activate("time"). My initial idea was that both should work, but that doesn't seem to be the case in this particular example. I couldn't figure out why. Any idea?

mdsumner commented 2 years ago

no I saw that too and didn't understand that, I just changed it so the vignette works ...

I don't have the capacity to think this through atm but hope to soon