Skip to content

Shapes not aligned rrror when appending to a FileVariable in Python 3 #240

@zshaheen

Description

@zshaheen

This issue is only present in the Python 3 version of the code, not the Python 2 version.
When doing something like the example below, which concatenates data to a file, we get errors using Python 3.

out_file = cdms2.open(fnm, 'w')
for month_file_nm in monthly_files:
    month_file = cdms2.open(month_file_nm)
    data = month_file['FLNT']
   
    out_file.write(data)

The error is this:

Traceback (most recent call last):
  File "cdms_timeseries.py", line 69, in <module>
    out_file.write(data)
  File "/export/shaheen2/anaconda2/envs/acme_diags_env_dev_py3/lib/python3.6/site-packages/cdms2/dataset.py", line 2068, in write
    v[index:index + len(vec1)] = var.astype(v.dtype)
  File "/export/shaheen2/anaconda2/envs/acme_diags_env_dev_py3/lib/python3.6/site-packages/cdms2/fvariable.py", line 113, in __setitem__
    self._obj_.setitem(*(index, numpy.ma.filled(value)))
ValueError: shapes are not aligned

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions