Changeset 26319


Ignore:
Timestamp:
06/11/21 05:43:04 (4 years ago)
Author:
bdef
Message:

BUG: fixing checkconsistency returns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/dsl.py

    r26317 r26319  
    1414    """
    1515
    16     def __init__(self, *args): #{{{
    17         self.global_average_thermosteric_sea_level = np.nan # Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m).
    18         self.sea_surface_height_above_geoid        = np.nan # Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m).
    19         self.sea_water_pressure_at_sea_floor       = np.nan # Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!).
     16    def __init__(self, *args):  #{{{
     17        self.global_average_thermosteric_sea_level = np.nan  # Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m).
     18        self.sea_surface_height_above_geoid = np.nan # Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m).
     19        self.sea_water_pressure_at_sea_floor = np.nan  # Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!).
    2020
    2121        if len(args) == 0:
     
    2525    #}}}
    2626
    27     def __repr__(self): #{{{
     27    def __repr__(self):  #{{{
    2828        s = '   dsl parameters:\n'
    2929        s += '{}\n'.format(fielddisplay(self, 'global_average_thermosteric_sea_level', 'Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m).'))
     
    3333    #}}}
    3434
    35     def setdefaultparameters(self): #{{{
     35    def setdefaultparameters(self):  #{{{
    3636        self.global_average_thermosteric_sea_level = np.nan
    37         self.sea_surface_height_above_geoid        = np.nan
    38         self.sea_water_pressure_at_sea_floor       = np.nan
     37        self.sea_surface_height_above_geoid = np.nan
     38        self.sea_water_pressure_at_sea_floor = np.nan
    3939    #}}}
    4040
    41     def checkconsistency(self, md, solution, analyses): #{{{
     41    def checkconsistency(self, md, solution, analyses):  #{{{
    4242        # Early return
    43         if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc):
     43        if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc) or (md.transient.isoceantransport == 0):
    4444            return md
    45 
    4645        md = checkfield(md, 'fieldname', 'dsl.global_average_thermosteric_sea_level', 'NaN', 1, 'Inf', 1)
    4746        md = checkfield(md, 'fieldname', 'dsl.sea_surface_height_above_geoid', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
     
    5756        yts = md.constants.yts
    5857        WriteData(fid, prefix, 'name', 'md.dsl.model', 'data', 1, 'format', 'Integer')
    59         WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'DoubleMat', 'mattype', 2, 'timeseries', 1, 'yts', yts) # mattype 2, because we are sending a GMSL value identical everywhere on each element.
    60         WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) # mattype 1 because we specify DSL at vertex locations.
    61         WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) # mattype 1 because we specify bottom pressure at vertex locations.
     58        WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'DoubleMat', 'mattype', 2, 'timeseries', 1, 'yts', yts)  # mattype 2, because we are sending a GMSL value identical everywhere on each element.
     59        WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)  # mattype 1 because we specify DSL at vertex locations.
     60        WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)  # mattype 1 because we specify bottom pressure at vertex locations.
    6261    # }}}
    6362
    64     def extrude(self, md): #{{{
     63    def extrude(self, md):  #{{{
    6564        self.sea_surface_height_above_geoid = project3d(md, 'vector', self.sea_surface_height_above_geoid, 'type', 'node', 'layer', 1)
    6665        self.sea_water_pressure_at_sea_floor = project3d(md, 'vector', self.sea_water_pressure_at_sea_floor, 'type', 'node', 'layer', 1)
     
    6867    #}}}
    6968
    70 
    71     def initialize(self, md): #{{{
     69    def initialize(self, md):  #{{{
    7270        if np.isnan(self.global_average_thermosteric_sea_level):
    7371            self.global_average_thermosteric_sea_level = np.array([0, 0]).reshape(-1, 1)
Note: See TracChangeset for help on using the changeset viewer.