Giter VIP home page Giter VIP logo

xmovie's Introduction

xmovie

Build Status Documentation Status pre-commit.ci Status codecov % License: MIT DOI conda-forge package version conda-forge download count PyPI package version

A simple way of creating beautiful movies from xarray objects.

With ever-increasing detail, modern scientific observations and model results lend themselves to visualization in the form of movies.

Not only is a beautiful movie a fantastic way to wake up the crowd on a Friday afternoon of a weeklong conference, but it can also speed up the discovery process, since our eyes are amazing image processing devices.

This module aims to facilitate movie rendering from data objects based on xarray objects.

Xarray already provides a way to create quick and beautiful static images from your data using Matplotlib. Various packages provide facilities for animating Matplotlib figures.

But it can become tedious to customize plots, particularly when map projections are used.

The main aims of this module are:

  • Enable quick but high-quality movie frame creation from existing xarray objects with preset plot functions -- create a movie with only 2 lines of code.
  • Provide high quality, customizable presets to create stunning visualizations with minimal setup.
  • Convert your static plot workflow to a movie with only a few lines of code, while maintaining all the flexibility of xarray and Matplotlib.
  • Optionally, use Dask for parallelized frame rendering.

Installation

The easiest way to install xmovie is via conda:

conda install -c conda-forge xmovie

You can also install via pip:

pip install xmovie

Documentation

Check out the examples and API documentation at https://xmovie.readthedocs.io.

Quickstart

High-quality movies and gifs can be created with only a few lines

import xarray as xr
from xmovie import Movie

ds = xr.tutorial.open_dataset('air_temperature').isel(time=slice(0,150))
mov = Movie(ds.air)
mov.save('movie.mp4')

Saving a .gif is as easy as changing the filename:

mov.save('movie.gif')

That is it! Now pat yourself on the shoulder and enjoy your masterpiece.

The GIF is created by first rendering a movie and then converting it to a GIF. If you want to keep both outputs you can simply do mov.save('movie.gif', remove_movie=False)

xmovie's People

Contributors

dependabot[bot] avatar jbusecke avatar pre-commit-ci[bot] avatar richardscottoz avatar timothyas avatar tomchor avatar zmoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xmovie's Issues

Custom plot with projection

Hello,
Thanks for developing this package.
I am trying to generate a movie based on a two-panel figure, one of which a map.

I can get it to work when I don't use any geo projection (custom_plotfunc2). However, when I use cartopy, the movie is comprised of empty frames (custom_plotfunc1).
I am not sure what is causing the different outcome. Thanks a lot

import xarray as xr
import cmaps
import matplotlib.pyplot as plt
import numpy as np
import cartopy.crs as ccrs
import os
from multiprocessing import Pool
from xmovie import Movie

def custom_plotfunc1(ds, fig, tt, *args, **kwargs):
# Define station location for timeseries
station = dict(lat=44.45, lon=111.1)
ds_station = ds.sel(**station,method='nearest')

fig = plt.figure()
gs = fig.add_gridspec(5, 3)

ax1 = fig.add_subplot(gs[:, 0:2], projection=ccrs.PlateCarree())
ax1.coastlines(resolution='auto', color='k')

ds.isel(time=tt).plot(ax=ax1, vmin=ds.min(), vmax=ds.max(),
                      cmap=cmaps.WhiteBlueGreenYellowRed,transform=ccrs.PlateCarree(),
                      cbar_kwargs={'orientation':'horizontal','label':'cm/s',
                                  'shrink':0.8,'pad':0.01})
ax1.plot(station['lon'], station['lat'], marker='o', markerfacecolor="None",
     markeredgecolor='black',
         markersize=6,transform=ccrs.PlateCarree())
ax1.set_title('');
ax1.coastlines()

ax2 = fig.add_subplot(gs[2:4, 2])

ds_station.isel(time=slice(0,tt+1)).plot(ax=ax2)
ax2.set_xlim([ds_station['time'].min(),ds_station['time'].max()])

ax2.set_ylim(ds_station.min(), ds_station.max())
ax2.set_title('Data at station');


return None,None

def custom_plotfunc2(ds, fig, tt, *args, **kwargs):

station = dict(lat=44.45, lon=111.1)
ds_station = ds.sel(**station,method='nearest')

(ax1, ax2) = fig.subplots(ncols=2)

ds.isel(time=tt).plot(ax=ax1, vmin=ds.min(), vmax=ds.max(),
                      cmap=cmaps.WhiteBlueGreenYellowRed,
                      cbar_kwargs={'orientation':'horizontal','label':'cm/s',
                                  'shrink':0.8,'pad':0.01})
ax1.plot(station['lon'], station['lat'], marker='o', markerfacecolor="None",
     markeredgecolor='black',
         markersize=6)
ax1.set_title('');

ds_station.isel(time=slice(0,tt+1)).plot(ax=ax2)
ax2.set_xlim([ds_station['time'].min(),ds_station['time'].max()])

ax2.set_ylim(ds_station.min(), ds_station.max())
ax2.set_title('Data at station');

return None, None

ds = xr.open_dataset('/work/f1p/H2/Matteo/ERA5_22.50/daily/GFDL_vd_H2_scale_f.nc').sel(time=slice('2005-01-01','2005-02-01'))
ds['time'] = ds.indexes['time'].to_datetimeindex()

mov_custom = Movie(ds['H2']*100., custom_plotfunc2)
mov_custom.save('/ptmp/Fabien.Paulot/movie_custom.gif', progress=True)

Multiple panels with multiple xarray objects

This might be a little bit complicated, but I will create the issue in case someone else is interested.

I found a workaround doing the way I used to do before: creating the frames and later merging them using ffmpeg.

But what I I have different xarray objects with different resolutions. Let's say its the output from the same model with lower resolution.
And I want to plot each of the model outputs in a different panel.

By now, the only alternative would be for change the name of the dimensions in the coarse model to (x_coarse, y_coarse, z_coarse, t_coarse), merge the objects and give a single dataset to xmovie, right?

Is that a better way to do that?

If this is too confusing, I can try to reproduce it with code snippet.

Customize framerates

It would be nice to have options to adjust the framerate.
In some circumstances (low time resolution) people might prefer a ‘stop motion’ style animation.

Deprecation warnings in the tests

I noticed some deprecation warnings when running the tests that could be addressed, related to

  • setting the background color of a GeoAxes
  • xarray argmin behavior.
xmovie/test/test_core.py: 144 warnings
  /mnt/c/Users/zmoon/git/xmovie/xmovie/presets.py:168: DeprecationWarning: The background_patch property is deprecated. Use GeoAxes.patch instead.
    ax.background_patch.set_facecolor(bgcolor)

xmovie/test/test_core.py: 48 warnings
  /home/zmoon/miniconda3/envs/xmovie-test/lib/python3.10/site-packages/xarray/core/dataarray.py:4407: DeprecationWarning: Behaviour of argmin/argmax with neither dim nor axis argument will change to return a dict of indices of each dimension. To get a single, flat index, please use np.argmin(da.data) or np.argmax(da.data) instead of da.argmin() or da.argmax().
    result = self.variable.argmin(dim, axis, keep_attrs, skipna)

Showing the ffmpeg command

I think it would be nice to have the option of printing the resulting ffmpeg command that xmovie issues. I just went through a situation where all the images were generated but ffmpeg failed. The figures were still there (and they took a long time to generate), but I still had to re-do them all on my second try. Having the ffmpeg command would have saved me the trouble. I could have just issued the command in the terminal.

Thanks!

ffmpeg version

I just encountered an error with the ffmpeg conversion using version 4.x.
I am not entirely sure if there were changes in the syntax, but for now I will restrict the version to 3.x.

Feature request for `bbox_inches = "tight"`

First, thanks for putting this together. This is great and saves me an incredible amount of time and effort.

Is there any interest in putting in a flag for bbox_inches = "tight" in the savefig call here

fig.savefig(

I get a fair amount of whitespace with the config that I have at the moment that will be removed by this fix. We can probably add a flag to the save call itself and send it downstream, but open to ideas! Also, happy to send in the PR too if this makes sense

Error saving when using parallel option on Dataset, index error on the dims

install method: pip
OS: Linux
Version: 0.1.0
I have a 1,000 frame dataset (yes I realize full support is yet to be added). I am trying to use the parallel option.
Screen Shot 2022-03-23 at 6 48 32 AM

def custom_plotfunc(ds, fig, tt, *args, **kwargs):
    ax = plt.axes(projection=projection)
    ds_lat_lon.reflectivity.sel(z=1000, method="nearest").isel(time=tt).plot.pcolormesh(vmin=-10, vmax=64,
                                              cmap=pyart.graph.cm_colorblind.HomeyerRainbow)
    gl = ax.gridlines(draw_labels=True,
                  linewidth=2, color='gray', alpha=0.5, linestyle='--')
    ax.add_feature(cfeature.COASTLINE)
    
    return None, None

mov_parallel = Movie(ds_lat_lon.chunk({'time':1}), custom_plotfunc, input_check=False)

    'movie_parallel.gif',
    parallel=True,
    overwrite_existing=True,
    gif_resolution_factor=1.0
)```

Error
```---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-88-2597ccea2720> in <module>
      2     'movie_parallel.gif',
      3     parallel=True,
----> 4     overwrite_existing=True,
      5 )

~/.conda/envs/pyart-simple/lib/python3.6/site-packages/xmovie/core.py in save(self, filename, remove_frames, remove_movie, progress, verbose, overwrite_existing, parallel, parallel_compute_kwargs, framerate, ffmpeg_options, gif_palette, gif_resolution_factor, gif_framerate)
    516         if parallel:
    517             self.save_frames_parallel(
--> 518                 dirname, parallel_compute_kwargs=parallel_compute_kwargs
    519             )
    520         else:

~/.conda/envs/pyart-simple/lib/python3.6/site-packages/xmovie/core.py in save_frames_parallel(self, odir, parallel_compute_kwargs)
    391                 f"Input data needs to be a dask array to save in parallel. Please chunk the input with single chunks along {framedim}."
    392             )
--> 393         framedim_chunks = da.chunks[da.dims.index(framedim)]
    394 
    395         if not all([chunk == 1 for chunk in framedim_chunks]):

AttributeError: 'Frozen' object has no attribute 'index'```

Just to check its not my custom func

ds_lat_lon.chunk({'time':1}).dims.index


AttributeError Traceback (most recent call last)
in
----> 1 ds_lat_lon.dims.index

AttributeError: 'Frozen' object has no attribute 'index'```

Is this due to it being a dataset rather than data array?

Potential crossover with animatplot?

Hi,

This is really cool, and I've been trying to make something fairly similar using animatplot and integrating it directly into xarray. I'm just wondering how much crossover there might be here? We're both trying to animate xarray objects, use xarray's plotting methods, output as gifs (you're also doing movies), and have flexibility to use libraries like cartopy in conjunction.

On the other hand you're essentially stitching frames together from outside xarray, whereas I'm trying to write animation methods into xarray itself.

What do you think?

Pixel-by-pixel output comparison between saving methods

This might be a bit overkill, but given some time, I would like to implement a test that checks output files on a pixel by pixel basis. This would expose inconsistencies between the serial and parallel saving methods (which could be helpful to ensure results stay the same when e.g. further tuning the dask performance).

For now just a reminder.

The scheduled build failed

The scheduled CI failed for python 3.9. Not sure if there is an issue with dependencies or just a glitch.

I have restarted the jobs to exclude the latter for now.

Once this is resolved, I will tag v0.2.0.

New framerate option not producing expected results

@jbusecke I have tested the framerate option but for reason it's not outputting the correct results for me. At least it's not the result I expected.

I'm trying to write a DataFrame with 42 frames here. However, if I set framerate=10, the number of frames of the video is only 18. If I set framerate=2, the number of frames of the video is only 5.

I'm pasting the relevant line of MP4Box -info below for both cases.

framerate=10:

Media Info: Language "Undetermined (und)" - Type "vide:avc1" - 18 samples

framerate=2

Media Info: Language "Undetermined (und)" - Type "vide:avc1" - 5 samples

The fps itself seems to be correctly set:

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 3600x1600 [SAR 1:1 DAR 9:4], 139479 kb/s, 10 fps, 10 tbr, 10240 tbn, 20 tbc (default) for fps=10.

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 3600x1600 [SAR 1:1 DAR 9:4], 36892 kb/s, 2 fps, 2 tbr, 16384 tbn, 4 tbc (default) for fps=2.

This can probably be fixed by manually passing flags to ffmpeg (although I haven't tried), but I think it's better if this behavior is corrected, right? Am I missing something here or is it really not the expected behavior?

gif always small

Don't know if its just me but if I save as .mov things are good but .gif even with gif_resolution_factor=2.0 makes a small gi
movie_parallel (1)
f

Automate ffmpeg commands

So far xmovie really only was a wrapper around printing single frames. I have just started a PR (#3) to enable the package to automate these commands.

This enables the user to create a movie with simply doing:

mov = Movie(da)
mov.save('moviename.mp4')
# or for a gif
mov.save('gifname.gif')

The procedure always creates intermediate frames and movies, which are deleted by default.
All intermediate products can be preserved with kwargs.
For instance,
mov.save('title.gif', remove_movie=False) will create both title.mp4 and title.gif.

custom_plotfunc() got an unexpected keyword argument 'vmin'

Hello, I am trying to run the First_Steps notebook. Creating an animation by wrapping the plotting calls in a function results in the following error message:

TypeError: custom_plotfunc() got an unexpected keyword argument 'vmin'

I think this may have to do with the way the kwargs are passed on to the the plotting functions, but I'm not too familiar with the code to come up with a fix for now.

How to plot contour lines on top of animation

Hello! I have successfully made animations (thank you!) but now am interested in making the animations look like the still figures I create. At the very least, how can I plot contour lines on top of the animations? See below for how I plot a still figure with contours for the top 300m of the ocean. Below the script is the resulting figure (top 300m and 300-6000m). Thank you!

fig,axs = plt.subplots(1,1,figsize=(15,2))

i = plt.pcolor(TLAT_A16, da.z_t, sDIC_NP_A16_plot.sel(time=slice(date1_1,date2_1)).mean('time'), cmap='plasma', vmin=1950, vmax=2450)

j = plt.contour(TLAT_A16, da.z_t, NP_pd_A16.sel(time=slice(date1_1,date2_1)).mean('time'), levels, colors='w', linewidth=2)
plt.clabel(j, fmt='%2.1f', colors='w', fontsize=28)

plt.title('')
plt.xlabel('')
plt.ylabel('')
plt.ylim(300,0) # reverse y-axis
plt.gca().invert_xaxis() # reverse x-axis for Atlantic
plt.tick_params(labelsize=15, length=15, direction='out', tick1On=True, labelbottom=True, labelleft=False)
plt.tick_params(axis='y', left=False)
cb = plt.colorbar()
cb.remove();

Picture1

We need docs

The explanations in the Readme are limited and do not explore all options already available.
xmovie needs a proper documentation. This is probably the most pressing issue at the moment.

error during pip install (`geos_c.h` not found)

Hi, I'm trying to install the package in a venv and I am getting the following error:

      lib/cartopy/trace.cpp:767:10: fatal error: geos_c.h: No such file or directory
        767 | #include "geos_c.h"
            |          ^~~~~~~~~~

which obviously comes from one of your requirements, the cartopy. I was wondering if this module is essential (I wasn't going to plot any maps), as its requirement list is quite long?

The xmovie tool seems quite generic for the xarray, so would it make sense to drop this requirement (perhaps at a price of some of the functionality)?

How can I use ProPlot?

Hi,

I noticed that in order to give a custom function, I need to assume that the fig object already exist.
Can I give a fig object?

I would like to use ProPlot.

Error when saving movie file

I'm getting an error when I try to save my xmovie file. The frames are showing up in the output_dir where they're supposed to, but the final save doesn't work. I do have ffmpeg installed and have used it successfully for other things.

mov = Movie(
SSH.sla.sel(
longitude=slice(0,150),
time=slice("2019-05-01", "2019-08-2")),
cmap='RdBu',
vmin=-.3, vmax=.3,
levels=41,
plotmethod='contourf',
extend='both'
)
mov.preview(30) # To preview a specific frame
mov.save(
output_dir + 'SLA2019_Saildrone_movie.mp4',
progress=True,
overwrite_existing=True,
verbose=True
)
! rm output_dir + frame_*.png

Yields the following error:

ValueError Traceback (most recent call last)
/var/folders/77/krt31b_92xg9grw6m3r25r380000mn/T/ipykernel_53094/1418684609.py in
11 )
12 mov.preview(30) # To preview a specific frame
---> 13 mov.save(
14 output_dir + 'SLA2019_Saildrone_movie.mp4',
15 progress=True,

~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in save(self, filename, remove_frames, remove_movie, progress, verbose, overwrite_existing, parallel, parallel_compute_kwargs, framerate, ffmpeg_options, gif_palette, gif_resolution_factor, gif_framerate)
522
523 # Create movie
--> 524 combine_frames_into_movie(
525 dirname,
526 moviefile,

~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in combine_frames_into_movie(sourcefolder, moviename, frame_pattern, remove_frames, verbose, ffmpeg_options, framerate)
209 sourcefolder, moviename, framerate, frame_pattern, ffmpeg_options
210 )
--> 211 p = _check_ffmpeg_execute(command, verbose=verbose)
212
213 print("Movie created at %s" % (moviename))

~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in _check_ffmpeg_execute(command, verbose)
134 else:
135 try:
--> 136 p = _execute_command(command, verbose=verbose)
137 return p
138 except RuntimeError:

~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in _execute_command(command, verbose, error)
116 if out_check != "":
117 # only display 10 lines, this cant be that hard?
--> 118 sys.stdout.write(out)
119 sys.stdout.flush()
120 else:

~/opt/anaconda3/lib/python3.8/site-packages/ipykernel/iostream.py in write(self, string)
499
500 if not isinstance(string, str):
--> 501 raise ValueError(
502 "TypeError: write() argument must be str, not {type(string)}"
503 )

ValueError: TypeError: write() argument must be str, not {type(string)}

Many stale branches

Could delete to tidy things up a bit for potential forkers. Or start PR / merge if applicable.

Using joblib to parallelize plotting

I realize there's another issue about the same functionality using dask, but apparently there are some glitches that haven't been easy to resolve. There were talks about dask's map_blocks but nothing got implemented. Today I came across an alternative by @ali-ramadhan, which is joblib, which might be worth considering.

You can see it being used in this script, and apparently the only "trick" needed here was to load the dataset in the function is that he "needed to open the dataset inside the function called by joblib". Other than that I think all that was needed was the addition of one joblib call in line 127: https://github.com/CliMA/Oceananigans.jl/blob/7a2c52442b780222e6700f5a99e3be24c4de909d/validation/lid_driven_cavity/plot_lid_driven_cavity.py#L127

CC: @dcherian @ali-ramadhan

Making movies using faceting

Basically I have a dataset that I'd to plot using facegrid, but I couldn't figure out a way to do this using xmovie since plotfunc() apparently needs to include the figure in its signature, and I don't think I can do faceting and specify the figure at the same time.

Is this currently possible?

Parallel plotting isn't working with Datasets

Parallel plotting seems to be working fine when the input is a DataArray, but I keep getting an error when trying to plot a Dataset. Consider the example below (adapted from the docs):

import xarray as xr
from xmovie import Movie

ds = xr.tutorial.open_dataset('air_temperature').isel(time=slice(0, 50))

def custom_plotfunc(ds, fig, tt, *args, **kwargs):
    station = dict(x=100, y=150)
    ds_station = ds.sel(**station).air
    (ax1, ax2) = fig.subplots(ncols=2)
    ds.isel(time=tt).plot(ax=ax1, vmin=ds.min(), vmax=ds.max(), cmap='RdBu_r')
    ds_station.isel(time=slice(0,tt+1)).plot.line(ax=ax2, x='time')
    return None, None

mov_parallel = Movie(ds.chunk({'time':1}), vmin=230, vmax=310, input_check=False)
mov_parallel.save(
    'movie_parallel.mov',
    parallel=True,
    overwrite_existing=True,
)

This fails with

In [1]: %run mwe.py
/home/tomas/miniconda3/envs/p39/lib/python3.9/site-packages/xmovie/presets.py:18: UserWarning: No `fieldname` supplied. Defaults to `air`
  warnings.warn(
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File ~/repos/Oceananigans.jl/sandbox/mwe.py:15, in <module>
     12     return None, None
     14 mov_parallel = Movie(ds.chunk({'time':1}), vmin=230, vmax=310, input_check=False)
---> 15 mov_parallel.save(
     16     'movie_parallel.mov',
     17     parallel=True,
     18     overwrite_existing=True,
     19 )
     21 pause
     23 mov_parallel = Movie(ds.air.chunk({'time':1}), vmin=230, vmax=310)

File ~/miniconda3/envs/p39/lib/python3.9/site-packages/xmovie/core.py:517, in Movie.save(self, filename, remove_frames, remove_movie, progress, verbose, overwrite_existing, parallel, parallel_compute_kwargs, framerate, ffmpeg_options, gif_palette, gif_resolution_factor, gif_framerate)
    515 # print frames
    516 if parallel:
--> 517     self.save_frames_parallel(
    518         dirname, parallel_compute_kwargs=parallel_compute_kwargs
    519     )
    520 else:
    521     self.save_frames_serial(dirname, progress=progress)

File ~/miniconda3/envs/p39/lib/python3.9/site-packages/xmovie/core.py:393, in Movie.save_frames_parallel(self, odir, parallel_compute_kwargs)
    389 if da.chunks is None:
    390     raise ValueError(
    391         f"Input data needs to be a dask array to save in parallel. Please chunk the input with single chunks along {framedim}."
    392     )
--> 393 framedim_chunks = da.chunks[da.dims.index(framedim)]
    395 if not all([chunk == 1 for chunk in framedim_chunks]):
    396     raise ValueError(
    397         f"Input data needs to be a with single chunks along {framedim}. Got these chunks instead ({framedim_chunks})"
    398     )

AttributeError: 'Frozen' object has no attribute 'index'

I'm sure this is something simple to solve due to some change in dask's API or something, but since I don't have time to investigate it and solve it right now I figured I'd at least report it.

CC @wenegrat: you mentioned a couple of weeks ago that the parallel feature wasn't working for you and I'm pretty sure this is why!

movie.save just hangs after a while with a large amount of frames

Hi Julius, Thanks for sharing this nice little package btw!

My jupyterlab is running on a docker image on a cloud based service (I think through jupyterhub at the University)
I have about 500 x 1920x1080xdpi100 frames. When I use this command:

mov.save("/home/jovyan/work/movie_frames/")

After a while it just stops saving frames, but I when I try to interupt the kernel , the notebook just hangs and I have to restart the kernel to get control back.

I've found a work around where I import frame_save and do the output in batches i.e. this works:

for i in range(300,400):
frame_save(mov.preview(i), i, odir="/home/jovyan/work/movie_frames/", frame_name="frame_",dpi=100)

Anyway, just thought I would mention this , to see if anyone else encounters this in the future, or if its specific to my environment.
I can't diagnose any errors, but you might have a suggestion how to do this

I don't think its a memory or cpu issue as the docker image has 256GB of memory and 64 vCPUs, and the memory doesn't get used up.

Add conda-forge feedstock

It would be nice to have a conda-forge feedstock, especially if that could include ffmpeg as dependency.

Not having ffmpeg on the system has caused some trouble in #29.

How long is long?

e.g.

C:\Users\rscott\AppData\Local\Continuum\anaconda3\envs\pangeo3\lib\site-packages\xmovie\core.py:46: UserWarning: No `vmin` provided. Data limits are calculated from input. Depending on the input this can take long. Pass `vmin` to avoid this step
  warnings.warn(
C:\Users\rscott\AppData\Local\Continuum\anaconda3\envs\pangeo3\lib\site-packages\xmovie\core.py:53: UserWarning: No `vmax` provided. Data limits are calculated from input. Depending on the input this can take long. Pass `vmax` to avoid this step
  warnings.warn(

Your 150 frame default example - how long would you expect that to take when not parallel, parallel, no vmin/vmax etc.?

I think it had run for 10 minutes before I killed it?

Wrong version appearing on v0.2.2 release

I see that this has been fixed on the main branch (I think), but the current tagged release (0.2.2) still has __version__ == 0.1 due to this line:

__version__ = "0.1.0"

So when I import the package I get:

In [1]: import xmovie

In [2]: xmovie.__version__
Out[2]: '0.1.0'

This isn't a major issue, but it took me 20 min of investigating to figure out what was going on! So I'd suggest tagging a new patch release right now to avoid confusion with other users.

Thanks!

Docs build failing

Our docs are failing to build. Ill try to switch RTD to use mamba and see if that fixes the problem.

Conflicting dependencies when installing via pip (Cartopy)

Hi,

I'm trying to install xmovie via pip but I keep getting errors related to conflicting dependencies.

I tried both in a conda and in a venv environment, obtaining similar errors.

OS: Ubuntu 20.04.4 LTS

Edit

It looks like the issue is related to cartopy installation (see SciTools/cartopy#1970, SciTools/cartopy#1967, SciTools/cartopy#1879).

conda environment

Steps to replicate

conda create -n xmovie python=3.9
conda activate xmovie
pip install xmovie

Output

Collecting xmovie
  Downloading xmovie-0.3.1-py3-none-any.whl (16 kB)
Collecting cartopy
  Downloading Cartopy-0.20.2.tar.gz (10.8 MB)
     |████████████████████████████████| 10.8 MB 2.8 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpyh7ycr95
       cwd: /tmp/pip-install-jftzwlvn/cartopy_022883b606944a7cb80fd22f18a95899
  Complete output (1 lines):
  Proj 8.0.0 must be installed in Conda environment "xmovie".
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/f6/55/1e1c737dc9436b320deead73d1c455ddbb74b8b6992081863492f6f6378a/Cartopy-0.20.2.tar.gz#sha256=4d08c198ecaa50a6a6b109d0f14c070e813defc046a83ac5d7ab494f85599e35 (from https://pypi.org/simple/cartopy/) (requires-python:>=3.7). Command errored out with exit status 1: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpyh7ycr95 Check the logs for full command output.
  Downloading Cartopy-0.20.1.tar.gz (10.8 MB)
     |████████████████████████████████| 10.8 MB 5.2 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpg5i65otv
       cwd: /tmp/pip-install-jftzwlvn/cartopy_0b710d11d63c42deb15d26cc3d5baa9d
  Complete output (1 lines):
  Proj 8.0.0 must be installed in Conda environment "xmovie".
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/fc/59/aa52698e3838f4cd0e7eaa75bd86837e9e0b05041dbdaee3cda2fffced06/Cartopy-0.20.1.tar.gz#sha256=91f87b130e2574547a20cd634498df97d797abd12dcfd0235bc0cdbcec8b05e3 (from https://pypi.org/simple/cartopy/) (requires-python:>=3.7). Command errored out with exit status 1: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpg5i65otv Check the logs for full command output.
  Downloading Cartopy-0.20.0.tar.gz (10.8 MB)
     |████████████████████████████████| 10.8 MB 3.9 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpr7vq8hbj
       cwd: /tmp/pip-install-jftzwlvn/cartopy_ecf5ec1eb01f4e31be2d208e195b4229
  Complete output (1 lines):
  Proj 8.0.0 must be installed in Conda environment "xmovie".
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/0f/c0/58453b036e79046d211f083880d58dcce787e7e07647ac25dc46c6555099/Cartopy-0.20.0.tar.gz#sha256=eae58aff26806e63cf115b2bce9477cedc4aa9f578c5e477b2c25cfa404f2b7a (from https://pypi.org/simple/cartopy/) (requires-python:>=3.7). Command errored out with exit status 1: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpr7vq8hbj Check the logs for full command output.
  Downloading Cartopy-0.19.0.post1.tar.gz (12.1 MB)
     |████████████████████████████████| 12.1 MB 5.1 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmppih05w_1
       cwd: /tmp/pip-install-jftzwlvn/cartopy_ed2db7cd006a4391ac0e7b943a09e9e0
  Complete output (1 lines):
  Proj 4.9.0 must be installed in Conda environment "xmovie".
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/ed/ca/524ce33692df3faeaa56852fb6a33b0b410be94cc288417565b96fef3f64/Cartopy-0.19.0.post1.tar.gz#sha256=4b8b4773a98ed7009fe17d9b6ec87ac3ac62b7d14634d7768c190eadc647d576 (from https://pypi.org/simple/cartopy/) (requires-python:>=3.5). Command errored out with exit status 1: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmppih05w_1 Check the logs for full command output.
  Downloading Cartopy-0.18.0.tar.gz (14.4 MB)
     |████████████████████████████████| 14.4 MB 6.1 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_b36d305f069f46bd81a348e776213f2d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_b36d305f069f46bd81a348e776213f2d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-h561j9wc
         cwd: /tmp/pip-install-jftzwlvn/cartopy_b36d305f069f46bd81a348e776213f2d/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_b36d305f069f46bd81a348e776213f2d/setup.py", line 43, in <module>
        import numpy as np
    ModuleNotFoundError: No module named 'numpy'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_b36d305f069f46bd81a348e776213f2d/setup.py", line 45, in <module>
        raise ImportError('NumPy 1.10+ is required to install cartopy.')
    ImportError: NumPy 1.10+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/46/c1/04e50c9986842f00f7db0e7a65caa896840050d7328f74e5b7437aa01179/Cartopy-0.18.0.tar.gz#sha256=7ffa317e8f8011e0d965a3ef1179e57a049f77019867ed677d49dcc5c0744434 (from https://pypi.org/simple/cartopy/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading Cartopy-0.17.0.tar.gz (8.9 MB)
     |████████████████████████████████| 8.9 MB 11.7 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpfmorpaar
       cwd: /tmp/pip-install-jftzwlvn/cartopy_7af50acaf90c4d25a60ab63417d02bf1
  Complete output (1 lines):
  Proj 4.9.0 must be installed in Conda environment "xmovie".
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz#sha256=424bd9e9ddef6e48cbdee694ce589ec431be8591f15b6cb93cb2b333a29b2c61 (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: /home/marco/miniconda3/envs/xmovie/bin/python /home/marco/miniconda3/envs/xmovie/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpfmorpaar Check the logs for full command output.
  Downloading Cartopy-0.16.0.tar.gz (8.8 MB)
     |████████████████████████████████| 8.8 MB 10.7 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_fb1682f06dfb42ad91604638d2fd8886/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_fb1682f06dfb42ad91604638d2fd8886/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-waynz20x
         cwd: /tmp/pip-install-jftzwlvn/cartopy_fb1682f06dfb42ad91604638d2fd8886/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_fb1682f06dfb42ad91604638d2fd8886/setup.py", line 47, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_fb1682f06dfb42ad91604638d2fd8886/setup.py", line 49, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/f5/7a/4a16db7c81f11b3c5889c5b913d9a5724c704a6947c5a87ec59c4a8985ac/Cartopy-0.16.0.tar.gz#sha256=f23dffa101f43dd91e866a49ebb5f5048be2a24ab8a921a5c07edabde746d9a4 (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading Cartopy-0.15.1.tar.gz (8.2 MB)
     |████████████████████████████████| 8.2 MB 7.6 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_4c0d4be2c72c4e3090c2604b5e964812/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_4c0d4be2c72c4e3090c2604b5e964812/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-jjt783du
         cwd: /tmp/pip-install-jftzwlvn/cartopy_4c0d4be2c72c4e3090c2604b5e964812/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_4c0d4be2c72c4e3090c2604b5e964812/setup.py", line 45, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_4c0d4be2c72c4e3090c2604b5e964812/setup.py", line 47, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/ee/6c/992e03af5a93c1b81d644a3fa0b0c43c4f8ccc9bc69837de46490f8dc3da/Cartopy-0.15.1.tar.gz#sha256=bb8a084055c38bc895b2fe094262753813e6fc7221ef2c1fc87ec1ff302f3c09 (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading Cartopy-0.14.2.tar.gz (8.4 MB)
     |████████████████████████████████| 8.4 MB 12.1 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_4211bd1b0e064bdea691e980da2d16d2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_4211bd1b0e064bdea691e980da2d16d2/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-9dqjl8b2
         cwd: /tmp/pip-install-jftzwlvn/cartopy_4211bd1b0e064bdea691e980da2d16d2/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_4211bd1b0e064bdea691e980da2d16d2/setup.py", line 45, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_4211bd1b0e064bdea691e980da2d16d2/setup.py", line 47, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/00/30/be768605774919e7571b72520b332f61fd307490923283292836872cb7a1/Cartopy-0.14.2.tar.gz#sha256=a7059587b91989ac42649f3d02aefbb4d3fd53ebb10ada34c007235820a000e7 (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading Cartopy-0.14.0.tar.gz (8.4 MB)
     |████████████████████████████████| 8.4 MB 6.6 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_51d4f62dc5fe435bb4862007fcca4435/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_51d4f62dc5fe435bb4862007fcca4435/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-w4try15u
         cwd: /tmp/pip-install-jftzwlvn/cartopy_51d4f62dc5fe435bb4862007fcca4435/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_51d4f62dc5fe435bb4862007fcca4435/setup.py", line 45, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_51d4f62dc5fe435bb4862007fcca4435/setup.py", line 47, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/ec/31/22528383a32ae03e31cee883173db7a5bcaa9452b0eeb94d6fd2cfa0fbde/Cartopy-0.14.0.tar.gz#sha256=2a3d26cb9c3af237209f9b3a3b0f50920dad9ab5ac4def0c468004c02f725df8 (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading Cartopy-0.13.1.tar.gz (7.7 MB)
     |████████████████████████████████| 7.7 MB 8.9 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_9d8bccf4541a42f88087c9f0403a71ff/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_9d8bccf4541a42f88087c9f0403a71ff/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-5eli2nf7
         cwd: /tmp/pip-install-jftzwlvn/cartopy_9d8bccf4541a42f88087c9f0403a71ff/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_9d8bccf4541a42f88087c9f0403a71ff/setup.py", line 39, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_9d8bccf4541a42f88087c9f0403a71ff/setup.py", line 41, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/57/42/ceb8bc7120998fcbeab9563f947ec3f334a0585afda6273a60e94e8d0792/Cartopy-0.13.1.tar.gz#sha256=779a75cd4a5553489cd71e4506685247d6ac94017a7979a50d09306b43e8d7ff (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading Cartopy-0.13.0.tar.gz (7.7 MB)
     |████████████████████████████████| 7.7 MB 11.8 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_d5983b2bad8046aa8d3617b83221161c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_d5983b2bad8046aa8d3617b83221161c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-av96o8ip
         cwd: /tmp/pip-install-jftzwlvn/cartopy_d5983b2bad8046aa8d3617b83221161c/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_d5983b2bad8046aa8d3617b83221161c/setup.py", line 36, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_d5983b2bad8046aa8d3617b83221161c/setup.py", line 38, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/32/81/8da9f2307971b5ae0c2e32763267814a91dcb3f0762432befcf37df7d16d/Cartopy-0.13.0.tar.gz#sha256=e8301460c5b5f9e57fa8de91772cfdf0360a04bbcd77ab102c3e678ad81a5474 (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading Cartopy-0.12.0.5.tar.gz (7.7 MB)
     |████████████████████████████████| 7.7 MB 13.5 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_815cc4fbab3d41abb009db8a22798fa5/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_815cc4fbab3d41abb009db8a22798fa5/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-2y0obu65
         cwd: /tmp/pip-install-jftzwlvn/cartopy_815cc4fbab3d41abb009db8a22798fa5/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_815cc4fbab3d41abb009db8a22798fa5/setup.py", line 36, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_815cc4fbab3d41abb009db8a22798fa5/setup.py", line 38, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/9a/b1/9723f24ddc542b14c86e233a93fdc2c1cf424c57b526160eeb45f454edc4/Cartopy-0.12.0.5.tar.gz#sha256=2c19a14f788fda4b6648995de3b38e02fc4fe46ee0156d01ddacfb32594a980c (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading Cartopy-0.12.0.4.tar.gz (7.7 MB)
     |████████████████████████████████| 7.7 MB 11.0 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_c8190abac5a147418fb338fc32ffd67f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_c8190abac5a147418fb338fc32ffd67f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-xsrbg16a
         cwd: /tmp/pip-install-jftzwlvn/cartopy_c8190abac5a147418fb338fc32ffd67f/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-jftzwlvn/cartopy_c8190abac5a147418fb338fc32ffd67f/setup.py", line 36, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_c8190abac5a147418fb338fc32ffd67f/setup.py", line 38, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/6c/fa/e4c45bd9c78e43f78d30b8d5e6fb884c045b017af51499f0b919ed8ce72c/Cartopy-0.12.0.4.tar.gz#sha256=f2796874bd1d8abf6b65324acd38f15f731a4ad1b0e9a806bf14036c946c4c87 (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading cartopy-0.11.0.tar.gz (7.7 MB)
     |████████████████████████████████| 7.7 MB 15.4 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/marco/miniconda3/envs/xmovie/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jftzwlvn/cartopy_61ca025ae33f46699d872c91a9a1d639/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jftzwlvn/cartopy_61ca025ae33f46699d872c91a9a1d639/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-otavnb_v
         cwd: /tmp/pip-install-jftzwlvn/cartopy_61ca025ae33f46699d872c91a9a1d639/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jftzwlvn/cartopy_61ca025ae33f46699d872c91a9a1d639/setup.py", line 31, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/1b/8e/ee4545577e897d0e45ee136513a28688abcb0dc4f26f9132177ec627c7ce/cartopy-0.11.0.tar.gz#sha256=85eb55d6ce16be5f7e745fcc2870b3fa7450db3a77899daade8b18711532be45 (from https://pypi.org/simple/cartopy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Collecting xmovie
  Downloading xmovie-0.3.0-py3-none-any.whl (16 kB)
  Downloading xmovie-0.2.2-py3-none-any.whl (15 kB)
  Downloading xmovie-0.1.0-py3-none-any.whl (10 kB)
ERROR: Cannot install xmovie==0.1.0, xmovie==0.2.2, xmovie==0.3.0 and xmovie==0.3.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    xmovie 0.3.1 depends on cartopy
    xmovie 0.3.0 depends on cartopy
    xmovie 0.2.2 depends on cartopy
    xmovie 0.1.0 depends on cartopy

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

venv environment

Steps to replicate

python3 -m venv venv
source venv/bin/activate
pip install xmovie

Output

Collecting xmovie
  Downloading xmovie-0.3.1-py3-none-any.whl (16 kB)
Collecting cartopy
  Downloading Cartopy-0.20.2.tar.gz (10.8 MB)
     |████████████████████████████████| 10.8 MB 2.8 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /home/marco/devel/xmovie/venv/bin/python3 /tmp/tmpi_7i_f9w get_requires_for_build_wheel /tmp/tmp_evocsxc
       cwd: /tmp/pip-install-g5htevtl/cartopy
  Complete output (1 lines):
  Proj version 6.3.1 is installed, but cartopy requires at least version 8.0.0.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/marco/devel/xmovie/venv/bin/python3 /tmp/tmpi_7i_f9w get_requires_for_build_wheel /tmp/tmp_evocsxc Check the logs for full command output.

framedim parameter broken

The framedim parameter of the Movie class does not seem to work. Here is a minimal example that fails for xmovie 0.1.0 installed via conda-forge:

import xarray as xr
import xmovie

ds = xr.tutorial.open_dataset('air_temperature').isel(time=slice(0, 150)).rename({'time': "TIME"})
mov = xmovie.Movie(ds.air, framedim="TIME")
mov.save('animation.gif', overwrite_existing=True)

There seems to be the assumption that the dataset must have a dimension with name time. This seems like a rather strong assumption.

Using dask to save frames in parallel

I am opening a separate issue for this functionality (previously mentioned in #2).

Currently the most time intensive step in creating a movie/gif is the rendering of each frame, which is done in serial.

In an earlier test version I implemented a parallelization of the printing using dask. The speedup was very nice, but I encountered quite strange errors with some matplotlib elements: E.g. the colorbar label would shift around and other odd things that looked less than premium.

I would like to try to implement this again with the substantially refactored code.
The proposed changes would replace the default save_frames with save_frames_parallel if a dask array is passed, so that mov.save(moviename.mp4) would work in parallel out of the box and serial rendering could be forced with something like mov.save(moviename.mp4, render_parallel=False).

Overwriting error should come before generating the frames

Right now if I run a script again and I forget to delete the previous video, the package generates every single frame (which takes a while) and only then it throws an error and let's me know that I have to set overwrite=True. It would be much better if the package would first check that before generating every frame. That way if the error is to be raised, it will save me some minutes of dummy processing.

Thanks!

Simpler preset as default

Conversations in #6 suggest that problems described there might be related to cartopy. We need a hierarchy of presets for consistent testing:

  • The default preset should be as close as possible to what xarrray.plot() would produce (e.g. similar to animatplot.

  • I would like a simple_map preset that does projections with cartopy but doesnt default to fancy rotations etc like rotating_globe

Option to loop fields multiple times

I think it would be great to have an option to loop the underlying data array multiple times, while other parameters apply to the total length of the movie/gif.

For instance a yearlong dataset could be looped n times while the rotating_globe preset rotates around the earth once.

The proposed syntax would be something simple like mov.save('moviename.mp4', loop=4).

Warning when passing Datasets

I noticed that when I pass Datasets to Movie I get these warnings:

UserWarning: The provided plotfunc does not provide the expected number of output arguments. Expected a function ax,pp =plotfunc(...) but got %i output arguments. Inserting dummy values. This should not affect output.
UserWarning,

As the message says, this doesn't affect the output, but it is a bit annoying. I haven't figured out how to avoid them though. Mind shedding some light here?

Thanks!

Lighten requirements?

dask and cartopy could be optional requirements, with exceptions raised if code that needs them is called without them installed, as they are not needed for the core functionality. Just a thought.

Fully support xr.Dataset input

Quick reminder here:

I guess an additional test (or a parametrization for the existing ones) would have been ideal. In case you are up for adding that, I would wait, but not a big deal in my view.

I agree, but that would take considerably longer and I'm going to take some time off starting today. I thought it was better to get the bug fix out as soon as possible.

I can help you out in the future if you want to add tests for datasets and make that aspect of xmovies fully supported.

Originally posted by @tomchor in #83 (comment)

Title on Rotating globe preset

Hello, I loved the xmovie module: it is very neat (especially the rotating globe preset). In the case of the rotating globe preset, is there a way to have the date on the top of the gif? Also the ability to customize the colorbars (or in general), making the plots more user-defined would be great for the visualization
movie_rotating
.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.