Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a scalar variable #5

Closed
samharrison7 opened this issue Mar 26, 2021 · 3 comments
Closed

Creating a scalar variable #5

samharrison7 opened this issue Mar 26, 2021 · 3 comments

Comments

@samharrison7
Copy link
Contributor

Great work on the library, very useful!

Am I right in thinking there is no way to create a scalar variable at the moment? I.e. without any dimensions? Ideally I'd like to do something like:

var = nc%setVariable('scalar_varname', 'i16')
call var%setData(42)

If I'm correct, would you be happy for me to submit a pull request to add this functionality?

Cheers,
Sam

@schaefed
Copy link
Owner

Hi @samharrison7 ,

nice to see some interest in this.

It seems, that you are right and it is currently not possible to create scalar variables. If you find the time to prepare a pull request, I'd be happy to get this in.

Just out of curiosity: are you already using this module or are you still in an exploration phase?

@samharrison7
Copy link
Contributor Author

Thanks for the quick reply. I'll hopefully find some time over the next few weeks to get a PR together.

Yep I'm already using this for a model I'm writing (geospatial model of contaminant fate in soils and waters). It's a private repo at the moment, but will be released shortly and I'll send a link over when it is. This library has been super useful - so much easier than writing the native nf90 bindings.

@samharrison7
Copy link
Contributor Author

That was a lot easier than expected 😁 See the pull request #6.

FYI, I figured you could already create a scalar variable by passing an empty array to setVariable, but now you can do it without having to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants