Skip to content

AttributeError: module 'numpy' has no attribute 'NAN'. Did you mean: 'nan'? #21

@aekiss

Description

@aekiss

When running cice_from_mom to fix https://github.com/COSIMA/access-om3/issues/252 I get

+ cice_from_mom --ocean_hgrid ocean_hgrid.nc --ocean_mask ocean_mask.nc
Traceback (most recent call last):
  File "/g/data/tm70/aek156/domain-tools/C-grid-workflow/fill_fraction_0.5_AK/.venv/bin/cice_from_mom", line 8, in <module>
    sys.exit(cice_from_mom())
  File "/g/data/tm70/aek156/domain-tools/C-grid-workflow/fill_fraction_0.5_AK/.venv/lib/python3.10/site-packages/esmgrids/cli.py", line 42, in cice_from_mom
    mom = MomGrid.fromfile(ocean_hgrid, mask_file=ocean_mask)
  File "/g/data/tm70/aek156/domain-tools/C-grid-workflow/fill_fraction_0.5_AK/.venv/lib/python3.10/site-packages/esmgrids/mom_grid.py", line 106, in fromfile
    clat_t, clon_t, clat_u, clon_u, _, _ = make_corners(x, y)
  File "/g/data/tm70/aek156/domain-tools/C-grid-workflow/fill_fraction_0.5_AK/.venv/lib/python3.10/site-packages/esmgrids/mom_grid.py", line 176, in make_corners
    clon_t[:] = np.NAN
  File "/g/data/tm70/aek156/domain-tools/C-grid-workflow/fill_fraction_0.5_AK/.venv/lib/python3.10/site-packages/numpy/__init__.py", line 414, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'NAN'. Did you mean: 'nan'?

see esmgrids/mom_grid.py#L176.

Is np.NAN an alias of np.nan that's only available in some versions of numpy? ie should we use np.nan throughout the code instead?

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