Skip to content

Very slow slicing with libnetcdf 4.7.4 #1018

@kdpenner

Description

@kdpenner

Array slicing with libnetcdf 4.7.4 is very slow. The same slicing with 4.7.3 is fast.

To reproduce this issue, first download this file:

https://data.nodc.noaa.gov/thredds/catalog/ncei/woa/salinity/A5B7/0.25/catalog.html?dataset=ncei/woa/salinity/A5B7/0.25/woa18_A5B7_s16_04.nc

(I can't generate a MWE file.)

And run this code:

from netCDF4 import Dataset
import time

nf=Dataset('woa18_A5B7_s16_04.nc', 'r')

t0=time.time()
for i in range(100):
    for j in range(100):
        q=nf['s_an'][0,:,i,j]
t=time.time()-t0
print('it took: '+str(t))
nf.close()

With this environment:

# Name                    Version                   Build  Channel
libnetcdf                 4.7.3           nompi_hc957ea6_101    conda-forge
netcdf4                   1.5.3           nompi_py37h0154fc0_102    conda-forge

the code runs in ~3s.

With this environment:

# Name                    Version                   Build  Channel
libnetcdf                 4.7.4           nompi_hc957ea6_101    conda-forge
netcdf4                   1.5.3           nompi_py38h5d7d79e_103    conda-forge

I kill the process before it terminates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions