Adding create_movie() in ROMSOutput class + support in plot.py#611
Adding create_movie() in ROMSOutput class + support in plot.py#611blsaenz wants to merge 4 commits into
Conversation
|
Adding PR for visibility. I still need to create documentation. |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #611 +/- ##
===========================================
- Coverage 86.27% 54.82% -31.46%
===========================================
Files 28 28
Lines 6171 6452 +281
Branches 1101 1151 +50
===========================================
- Hits 5324 3537 -1787
- Misses 564 2624 +2060
- Partials 283 291 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 24 files with indirect coverage changes 🚀 New features to boost your workflow:
|
…dding objects, which are big
kthyng
left a comment
There was a problem hiding this comment.
Is it a good time to try this or are there more changes coming to wait for? I haven't tried it yet but would like to!
| ) | ||
|
|
||
| @staticmethod | ||
| def _cmap_name_for_var(var_name: str) -> str: |
There was a problem hiding this comment.
I have a package called xcmocean that I haven't looked at for awhile (https://github.com/pangeo-data/xcmocean) which is meant to do this job in a more general way: use regex to match variable names to the likely intended cmocean colormap. It's a bit kludgey with the variable matching, but has some good parts.
There was a problem hiding this comment.
We can consider it but maybe in a differenct PR? This function is actually just a re-wrapping of what ROMS-Tools does now for plot() for picking a colormap, so I am not introducing anything new or exciting here. I don't even know if we can use a custom colormap. Design-wise, I am under the impression we are not trying to support 'fancy' plotting options, but it would b good to bring up in standup or backlog grooming since I don't know for sure.
| field.load() | ||
| return field | ||
|
|
||
| def create_movie( |
There was a problem hiding this comment.
does this also save the individual images that are being used to create the animation? I often like to use those individually too (then link with ffmpeg), personally, so it might be nice if that is possible with this approach.
There was a problem hiding this comment.
No, in fact I used the Animation class in matplotlib specifically to avoid creating gigabytes of individual plots. I think it's cleanest just to give what is is the name - a single movie . And then if you find a frame where an individual plot is needed, it is easy to call plot() with the same parameters to generate it the time/slice where you need it?
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
Updated documentation! Ready for full review I think |
This PR adds movie-making abilities to ROMSoutput (ROMSoutput.create_movie()), with similar inputs as the plot() method. It builds upon the plot() functionality in plot.py, but required a bit of abstracting and refactoring to re-use that code.
Example:
cdr_output.create_movie(
"ALK_source",
time_range=slice(0, -1, 6), # every 6 output (here, every six hours)
fps=6, # frames per second
output_file="simulation_ALK_source.mp4",
s=-1, # surface
include_boundary=True, # include boundary grid cells
timestamp_xy=(0.05, 0.95) # display a time stamp at plot axes (x,y)
)
pre-commit run --all-filesdocs/releases.mddocs/api.rst