podaac/l2ss-py

ML2O3 Variable error when copying values

Closed this issue · 2 comments

191 # Copy data
192 var_group.variables[new_var_name].set_auto_maskandscale(False)

--> 193 var_group.variables[new_var_name][:] = var_data

ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between arg 0 with shape (3495, 3495) and arg 1 with shape (3495, 2770).

Unique groups needed for each lat_var_name.

    input_lats_mls = ['__HDF__swaths__o3__geo__latitude',
                      '__HDF__swaths__o3 columns__geo__latitude',
                      '__HDF__swaths__o3-apiori__geo__latitude']

unique groups should be for variable subsetting:

    expected_groups_mls = ['__HDF__swaths__o3',
                                               '__HDF__swaths__o3 columns',
                                               '__HDF__swaths__o3-apiori']
191 # Copy data
192 var_group.variables[new_var_name].set_auto_maskandscale(False)

--> 193 var_group.variables[new_var_name][:] = var_data

ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between arg 0 with shape (3495, 3495) and arg 1 with shape (3495, 2770).

Error is caused by lat_var_name_prefix. [:-1] should be more generalized to the last index for a unique group rather than assuming the unique group name is always a group above the lat variable.

line 785: GROUP_DELIM.join(lat_var_name.strip(GROUP_DELIM).split(GROUP_DELIM)[:-1])