netcdf.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. # This file is not meant for public use and will be removed in SciPy v2.0.0.
  2. # Use the `scipy.io` namespace for importing the functions
  3. # included below.
  4. import warnings
  5. from . import _netcdf
  6. __all__ = [ # noqa: F822
  7. 'netcdf_file', 'netcdf_variable',
  8. 'array', 'LITTLE_ENDIAN', 'IS_PYPY', 'ABSENT', 'ZERO',
  9. 'NC_BYTE', 'NC_CHAR', 'NC_SHORT', 'NC_INT', 'NC_FLOAT',
  10. 'NC_DOUBLE', 'NC_DIMENSION', 'NC_VARIABLE', 'NC_ATTRIBUTE',
  11. 'FILL_BYTE', 'FILL_CHAR', 'FILL_SHORT', 'FILL_INT', 'FILL_FLOAT',
  12. 'FILL_DOUBLE', 'TYPEMAP', 'FILLMAP', 'REVERSE', 'NetCDFFile',
  13. 'NetCDFVariable'
  14. ]
  15. def __dir__():
  16. return __all__
  17. def __getattr__(name):
  18. if name not in __all__:
  19. raise AttributeError(
  20. "scipy.io.netcdf is deprecated and has no attribute "
  21. f"{name}. Try looking in scipy.io instead.")
  22. warnings.warn(f"Please use `{name}` from the `scipy.io` namespace, "
  23. "the `scipy.io.netcdf` namespace is deprecated.",
  24. category=DeprecationWarning, stacklevel=2)
  25. return getattr(_netcdf, name)