-
Notifications
You must be signed in to change notification settings - Fork 113
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
Updating remote access notebook #291
Open
betolink
wants to merge
12
commits into
xarray-contrib:main
Choose a base branch
from
betolink:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2014fbd
adding remote access with fsspec notebook
betolink 917047d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 77bdcb5
fix typo
betolink e5e45fa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8bbc512
update data paths, loca conda env, toc
scottyhq 8eccb5d
remove non-existant link, add sphinx-mermaid
scottyhq 4d3cd3f
Merge branch 'xarray-contrib:main' into master
betolink 83d97cb
update notebook, fixing typos
betolink ab3aa63
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fe9141c
adding fo to allowed word list for spelling checks
betolink 9179ade
trying to fix link checks
betolink 7dcad13
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to leave some review comments on the whole notebook top to bottom rather than just the new changes since I didn't go over it carefully the first round!
> It is important to note that there are...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this first note you say "use of a file handler and a cache" but I didn't see anything about the cache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supported file formats by backend: It's not clear what
BufferedIOBase
andAbstractDataStore
are and where they come from. Consider defining these in a bit more detail, or introduce them later on. What is a "buffer" vs a file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"it’s really an anti pattern when we work with scientific data formats. Benchmarks show that any of the caching schemas will perform better than using the default read-ahead." -> "It's not ideal with common multidimensional binary data formats." Can you link to benchmarking results?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The keyword argument and uri should match here (
filecache::{uri}
). If I remember correctlyfilecache
exposes a bit more control and the cache persists if you say close a notebook and come back to it, so I recommend that! I also like usingsame_names=True
so that if you're working with multiple files you can do other things with them (like open in QGIS or other software) if you want.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new ability to keep track of cache activity is super handy! I'm confused though, I think it's important to note that
'total requested bytes' != 'total transferred bytes'
? Also what is the cause of thecache hits
andcache misses
? :There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"to cloud storage, but using the default caching." --> remove ", but using the default caching"? since you use blockcache in the code below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remote data access and chunking: How about adding a tiny bit more here? For example, I think it's often a great starting point for people wanting to work with remote data to consider 1. the total file size (
ds.nbytes
) 2. is the file chunked (ds.sst.encoding
) 3. what do you want to do with it (in particular are you needing to compute the mean of all pixels or just read a single pixel?).Maybe a specific example? If I understand correctly, let's say you want the value of a single pixel from
s3://sst.mnmean.nc
(ds.isel(lon=0,lat=0,time=0)
). Using defaults, Xarray dispatches to h5netcdf/h5py which tries to read one 'chunk' (1, 89, 180) containing your pixel of interest. So this request is translated by fsspec to read ~128kb via an HTTP range request to S3, but using the default caching an additional 5MB is read. The entire file size in this case is just 4MB, so for efficiency rather than fiddling with cache settings, it might be best to just usefilecache::
so that all your Xarray computations read from the local file rather than possibly reading bits and pieces over the network.