-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add xarray backends for fgmax and fgout gridded formats #611
base: master
Are you sure you want to change the base?
Conversation
Thanks @kbarnhart for providing this! I haven't experimented with it much yet, but a few comments...
Eventually it would be nice to integrate this better with I hope to revamp the But for now it seems fine to merge this in, perhaps with some tweaks, so that it can be used for your purposes. @mandli and @ketch: I note that our new attempt at CI throws an error for this PR in the setup step:
Not sure if this is something to investigate? |
@rjleveque thanks for your comments. I'll make some updates to address them and ping you here when they are ready to consider. happy to be involved in integrating these better. |
Would the file |
@mandli - I thought a tiny amount about this and it seemed to me like there were two options. Either all the xarray backends go in one module or each xarray backend goes inside a module associated with the relevant clawpack data structure (e.g., the FGOutBackend goes in fgout_tools.py). I have a slight preference towards the latter option. However, I implemented the former because I didn't want to make the fgout_tools and fgmax_tools files longer and make it hard to discover the backends. All of this is to say that I'm not sure the best place for these within clawpack.geoclaw. |
@kbarnhart Those were the two options that came to my mind as well. Given that gauges are not actually handled here in GeoClaw but in PyClaw (it's common across most of the Clawpack packages) it may make more sense to keep them in the associated data structures. Similarly we could/should do something with other data formats, such as friction from land use or storm data, for which there may be multiple backends. Should be easy to change up until we merge this fully and make a release though. |
Variables when it makes sense should be named the same thing probably to reduce confusion although I do like the more descriptive variable you mentioned. |
Some notes based on conversation with @rjleveque:
|
@rjleveque, @mandli -
Here is a PR that addresses #598.
It may not be the most efficient (I flipud and transpose each array to put them in the orientation that xarray wants), but I find that it works.
I've tested the fgmax method on dclaw and geoclaw (the chile 2010 fgout-fgmax example) with each option for the number of variables written.
I've tested the fgout method with dclaw and geoclaw for both binary and ascii type files.
One point of discussion is whether you like the variable names I've use for fgmax (they are not exactly the same as in the fgmax object (e.g., I use h_max instead of h). I'm happy to change them to be identical if that is important to either of you.
I added an example usage script in the chile2010 fgout-fgmax example as it seemed the most sensible place to put an example.
Happy to improve this as you see fit.