MPAS-Dev / MPAS-Limited-Area

Python tool to create a regional subset of a global MPAS Mesh
http://mpas-dev.github.io/
21 stars 10 forks source link

AttributeError: NetCDF: Attribute not found #15

Closed yuemaaa closed 5 years ago

yuemaaa commented 5 years ago

Hi, I try to use 60-3 km mesh produce a 3 km mesh and while copying 'global attributes' it shows

Copying global attributes... Traceback (most recent call last): File "../create_region", line 65, in regional_area.gen_region(**kwargs) File "path/to/MPAS-Limited-Area/limited_area/limited_area.py", line 164, in gen_region mesh.copy_global_attributes(regionalMesh) File "path/to/MPAS-Limited-Area/limited_area/mesh.py", line 309, in copy_global_attributes region.mesh.n_scvt_iterations = self.mesh.n_scvt_iterations File "netCDF4/_netCDF4.pyx", line 2725, in netCDF4._netCDF4.Dataset.getattr File "netCDF4/_netCDF4.pyx", line 2671, in netCDF4._netCDF4.Dataset.getncattr File "netCDF4/_netCDF4.pyx", line 1289, in netCDF4._netCDF4._get_att File "netCDF4/_netCDF4.pyx", line 1754, in netCDF4._netCDF4._ensure_nc_success AttributeError: NetCDF: Attribute not found

Also it cannot produce a 'graph.info' file. How can I build a region_area mesh by an existing mesh without 'global attributes'?

yuemaaa commented 5 years ago

I notice that 15-3 km mesh having 'global attributes' and using it take place of 60-3 km. But it still shows a error message while copying 'variable xtime'

Copying variable xtime... Traceback (most recent call last): File "../create_region", line 65, in regional_area.gen_region(kwargs) File "/path/to/MPAS-Limited-Area/limited_area/limited_area.py", line 161, in gen_region kwargs) File "/path/to/MPAS7.0/MPAS-Limited-Area/limited_area/mesh.py", line 298, in subset_fields region.mesh.variables[var][:] = arrTemp[var] File "/path/to/anaconda3/lib/python3.7/site-packages/numpy/ma/core.py", line 3174, in getitem dout = self.data[indx] IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

mgduda commented 5 years ago

@yuemaaa Thanks for spotting these issues. PR #16 should address the issue with the 60-3 km mesh. We'll have a closer look at the issue with the 15-3 km mesh and create a PR as soon as we have a fix.

mgduda commented 5 years ago

@yuemaaa I think PR #17 should address the issue with the 15-3 km mesh.

mgduda commented 5 years ago

The two PRs that should address the issues here have been merged, so I'll close this PR.