Skip to content

Local and S3 windowed-reading Sentinel-2 rasters is 10x slower with rioxarray than xarray #438

Answered by snowman2
Bencpr asked this question in Q&A
Discussion options

You must be logged in to vote

rioxarray/xarray both use lazy loading to load data from the rasters. Calling win.load() will likely get you performance closer to rasterio.

rioxarray loads metadata from the files, so that is likely why it takes longer than xarray.

Also, can you provide the output of rioxarray.show_versions?

EDIT: To avoid the cost of re-opening the files, I recommend modifying the tests to:

for reader in readers:
    if reader == "xarray":
        xds = xr.open_rasterio(path)

    if reader == "rioxarray":
        xds = rioxr.open_rasterio(path)

  # time elapsed for n_tries
  time_tries = 0

  for n in range(n_tries):
      time_try = 0
      start = time()
  
      for col_off, row_off in zip(col_offs, 

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Bencpr
Comment options

You must be logged in to vote
5 replies
@snowman2
Comment options

@snowman2
Comment options

@Bencpr
Comment options

@snowman2
Comment options

@Bencpr
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants