podaac / l2ss-py

Level 2 subsetter with Harmony integration
https://podaac.github.io/l2ss-py/
Apache License 2.0
11 stars 11 forks source link

ML2O3 Variable error when copying values #155

Closed nlenssen2013 closed 1 year ago

nlenssen2013 commented 1 year ago
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).

nlenssen2013 commented 1 year ago

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']
nlenssen2013 commented 1 year ago
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])