Changeset 27864


Ignore:
Timestamp:
07/31/23 10:31:28 (20 months ago)
Author:
musselman
Message:

read_netCDF.m: Removed some log statements, added some comments related to functionality for nonstandard subclass instances

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/contrib/musselman/read_netCDF.m

    r27860 r27864  
    44    2. For each variable in each group, update an empty model with the variable's data
    55    3. Enter nested groups and repeat
     6
     7
     8If the model you saved has subclass instances that are not in the standard model() class
     9you can:
     10    1. Copy lines 30-35, set the "results" string to the name of the subclass instance,
     11    2. Copy and modify the make_results_subclasses() function to create the new subclass
     12        instances you need.
     13From there, the rest of this script will automatically create the new subclass
     14instance in the model you're writing to and store the data from the netcdf file there.
    615%}
    716
     
    8998
    9099
    91 %{
    92 function make_results_subclasses()
    93     global model_copy;
    94     global NCData;
    95     resultsGroup = netcdf.inqNcid(NCData, "results");
    96     subgroups = netcdf.inqGrps(resultsGroup);
    97     for subgroup = subgroups
    98         groupName = netcdf.inqGrpName(subgroup)
    99        
    100 
    101        
    102         class_instance = netcdf.inqVar(resultsGroup, name);
    103         class_instance_name = convertCharsToStrings(netcdf.getVar(resultsGroup, name, 'char'));
    104         model_copy.results = setfield(model_copy.results, class_instance, class_instance_name);
    105     end
    106     disp('Successfully recreated results struct')
    107 end
    108 %}
    109 
    110 
    111100function walk_nested_groups(group_location_in_file)
    112101    global model_copy;
     
    132121        if not(isempty(groups))
    133122            for group = groups
    134                 disp('found nested group!!')
     123                %disp('found nested group!!')
    135124                group_id = netcdf.inqNcid(group_location_in_file, netcdf.inqGrpName(group));
    136                 disp(netcdf.inqGrpNameFull(group_id))
     125                %disp(netcdf.inqGrpNameFull(group_id))
    137126                walk_nested_groups(group);
    138127            end
Note: See TracChangeset for help on using the changeset viewer.