Passing a 2D xarray data array to the spharm.regrid function raises the following error
ValueError: dimensions ('latitude', 'longitude') must have the same length as the number of data dimensions, ndim=3
which can be traced back to this line in grdin.grdtospec:
datagrid = numpy.reshape(datagrid, (nlat,nlon,1))
This can be easily fixed without causing any changes to the speed or functionality of the code by replacing this line in grdin.grdtospec with the following:
datagrid = numpy.expand_dims(datagrid, axis=2)
Note: I've noticed the offending line is in multiple places throughout spharm. Might be worth addressing?
Passing a 2D xarray data array to the spharm.regrid function raises the following error
ValueError: dimensions ('latitude', 'longitude') must have the same length as the number of data dimensions, ndim=3
which can be traced back to this line in grdin.grdtospec:
datagrid = numpy.reshape(datagrid, (nlat,nlon,1))
This can be easily fixed without causing any changes to the speed or functionality of the code by replacing this line in grdin.grdtospec with the following:
datagrid = numpy.expand_dims(datagrid, axis=2)
Note: I've noticed the offending line is in multiple places throughout spharm. Might be worth addressing?