Ignore:
Timestamp:
07/18/23 13:07:22 (20 months ago)
Author:
musselman
Message:

CHG: updating to 07-11 versions of musselman netcdf.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/contrib/musselman/write_netCDF_beta.py

    r27831 r27832  
    105105            adress_of_child_in_empty_class = 'empty_model' + adress_of_child.removeprefix(str(model_name))
    106106            print('adress_of_child_in_empty_class: '+ adress_of_child_in_empty_class + '\n')
    107             if type(child) == type(eval(adress_of_child_in_empty_class)):
    108                 print('passed a non-variable\n')
    109                 walk_through_subclasses(model_var, adress_of_child, model_name)
    110             # If it has been modified, record it in the NetCDF file
    111             else:
     107            # using try/except here because sometimes a model can have class instances/attributes that are not
     108            # in the framework of an empty model. If this is the case, we move to the except statement
     109            try:
     110                if type(child) == type(eval(adress_of_child_in_empty_class)):
     111                    print('passed a non-variable\n')
     112                    walk_through_subclasses(model_var, adress_of_child, model_name)
     113                # If it has been modified, record it in the NetCDF file
     114                else:
     115                    create_group(model_var, adress_of_child)
     116                    walk_through_subclasses(model_var, adress_of_child, model_name)
     117            except AttributeError:
    112118                create_group(model_var, adress_of_child)
    113119                walk_through_subclasses(model_var, adress_of_child, model_name)
Note: See TracChangeset for help on using the changeset viewer.