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

How can we use the save method with s3fs? #162

Open
tinaok opened this issue Mar 29, 2024 · 0 comments
Open

How can we use the save method with s3fs? #162

tinaok opened this issue Mar 29, 2024 · 0 comments

Comments

@tinaok
Copy link

tinaok commented Mar 29, 2024

I would like to use s3 storage for creating temporary image and final movies, in future to make use of dask cluster with shared s3 storage access.

import xarray as xr
from xmovie import Movie

ds = xr.tutorial.open_dataset('air_temperature').isel(time=slice(0,10))
mov = Movie(ds.air)
#mov.save('movie.mp4')
import s3fs
storage_options = {
    'anon': False, 
    }
}
s3 = s3fs.S3FileSystem(**storage_options )
pathvideo='demo3/video'
with s3.open(pathvideo, 'wb') as f:
     mov.save(f)

It does not accept the S3File.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[3], line 2
      1 with s3.open(pathvideo, 'wb') as f:
----> 2      mov.save(f)

File /srv/conda/envs/notebook/lib/python3.11/site-packages/xmovie/core.py:516, 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)
    466 """Save out animation from Movie object.
    467 
    468 Parameters
   (...)
    512     (The default is 10).
    513 """
    515 # parse out directory and filename
--> 516 dirname = os.path.dirname(filename)
    517 filename = os.path.basename(filename)
    519 # detect gif filename

File <frozen posixpath>:152, in dirname(p)

TypeError: expected str, bytes or os.PathLike object, not S3File
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

1 participant