Revision 106538f5c3e5805d574d526226ce853b217e8702 authored by Bill Sacks on 24 May 2021, 19:56:23 UTC, committed by Bill Sacks on 24 May 2021, 20:23:59 UTC
This is intended to support the GLC component having multiple
grids (e.g., Greenland & Antarctica), but the implementation handles any
component having multiple grids.

At a high level: If a component's grid is a colon-delimited string, then
it is assumed to specify multiple grids, separated by the colons. Then,
anywhere where we use the component's grid to create derived
variables (domain name, mapping file names, etc.), I have introduced a
loop over the list of grids for each component. For a component with
multiple grids, the derived variables then also end up as
colon-delimited strings, with one colon-delimited element per grid.

To avoid adding more complexity and deep nesting to the Grids class, I
have refactored it significantly in a few places. Main goals of the
refactoring were (1) extracting some logic into a helper class,
_ComponentGrids; among other things, this replaces various lookups that
were being done using tuples and dicts; and (2) extracting the bodies of
nested loops into new methods to avoid super-deep nesting.

I have also added unit tests of grids.py. The high-level tests of the
Grids class work by constructing little fake xml files on the fly. There
are also some tests of the lower-level helper functions. These unit
tests don't cover all of the logic in grids.py, but they do cover a lot
of the logic, with a particular focus on any parts of the code that I
had to change significantly for this work.

Resolves ESMCI/cime#3962
1 parent acd4cd8
Raw File
LICENSE.TXT
Copyright (c) 2017, University Corporation for Atmospheric Research (UCAR)
All rights reserved.
  and
Copyright (c) 2017, Sandia Corporation. 
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
  and
Copyright (c) 2017, UChicago Argonne, LLC, All Rights Reserved 
under Contract No. DE-AC02-06CH11357 with the Department of Energy

Developed by:
              University Corporation for Atmospheric Research - National Center for Atmospheric Research
              https://www2.cesm.ucar.edu/working-groups/sewg
                and
              DOE BER E3SM project team members, including those at SNL and ANL

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal with the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:

    - Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimers.
    - Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimers in the documentation
      and/or other materials provided with the distribution.
    - Neither the names of UCAR or Sandia Corporation,
      nor the names of its contributors may be used to endorse or promote
      products derived from this Software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
back to top