# Path: lib/eofs/tests/utils.py
# def sign_adjustments(eofset, refeofset):
#     """Sign adjustments for EOFs/PCs.
# 
#     Create a matrix of sign weights used for adjusting the sign of a set
#     of EOFs or PCs to the sign of a reference set.
# 
#     The first dimension is assumed to be modes.
# 
#     **Arguments:**
# 
#     *eofset*
#         Set of EOFs.
# 
#     *refeofset*
#         Reference set of EOFs.
# 
#     """
#     if eofset.shape != refeofset.shape:
#         raise ValueError('input set has different shape from reference set')
#     eofset, refeofset = __tomasked(eofset, refeofset)
#     nmodes = eofset.shape[0]
#     signs = np.ones([nmodes])
#     shape = [nmodes] + [1] * (eofset.ndim - 1)
#     eofset = eofset.reshape([nmodes, np.prod(eofset.shape[1:], dtype=np.int)])
#     refeofset = refeofset.reshape([nmodes,
#                                    np.prod(refeofset.shape[1:],
#                                            dtype=np.int)])
#     for mode in range(nmodes):
#         i = 0
#         try:
#             while _close(eofset[mode, i], 0.) or \
#                   _close(refeofset[mode, i], 0.) \
#                   or np.ma.is_masked(eofset[mode, i]) or \
#                   np.ma.is_masked(refeofset[mode, i]):
#                 i += 1
#         except IndexError:
#             i = 0
#         if np.sign(eofset[mode, i]) != np.sign(refeofset[mode, i]):
#             signs[mode] = -1
#     return signs.reshape(shape)
# 
# Path: lib/eofs/tests/reference.py
# def reference_solution(container_type, weights):
#     """Obtain a reference EOF analysis solution.
# 
#     **Arguments:**
# 
#     *container_type*
#         Either 'standard', 'cdms', 'iris' or 'xarray'.
# 
#     *weights*
#         Weights method. One of 'equal', 'latitude', or 'area'.
# 
#     """
#     container_type = container_type.lower()
#     weights = weights.lower()
#     if container_type not in ('standard', 'iris', 'cdms', 'xarray'):
#         raise ValueError("unknown container type "
#                          "'{!s}'".format(container_type))
#     solution = _read_reference_solution(weights)
#     time_units = 'months since 0-1-1 00:00:0.0'
#     neofs = len(solution['eigenvalues'])
#     _get_wrapper(container_type)(solution, neofs, time_units)
#     return solution


import numpy as np
import numpy.ma as ma
import pytest
import eofs
        import dask
        import dask
        import dask
        import dask
        import dask
    from iris.cube import Cube
from eofs.tests import EofsTest
from .utils import sign_adjustments
from .reference import reference_solution
    pass




# Create a mapping from interface name to solver class.
solvers = {'standard': eofs.standard.Eof}
try:
    solvers['cdms'] = eofs.cdms.Eof
except AttributeError:
    pass
try:
    solvers['iris'] = eofs.iris.Eof
except AttributeError:
    pass
try:
    solvers['xarray'] = eofs.xarray.Eof
except AttributeError:
    pass


class SolutionTest(EofsTest):
    """Base class for all solution test classes."""
    interface = None
    weights = None
    alternate_weights_arg = None

    @classmethod
    def setup_class(cls):
        try:

# Path: lib/eofs/tests/utils.py
# def sign_adjustments(eofset, refeofset):
#     """Sign adjustments for EOFs/PCs.
# 
#     Create a matrix of sign weights used for adjusting the sign of a set
#     of EOFs or PCs to the sign of a reference set.
# 
#     The first dimension is assumed to be modes.
# 
#     **Arguments:**
# 
#     *eofset*
#         Set of EOFs.
# 
#     *refeofset*
#         Reference set of EOFs.
# 
#     """
#     if eofset.shape != refeofset.shape:
#         raise ValueError('input set has different shape from reference set')
#     eofset, refeofset = __tomasked(eofset, refeofset)
#     nmodes = eofset.shape[0]
#     signs = np.ones([nmodes])
#     shape = [nmodes] + [1] * (eofset.ndim - 1)
#     eofset = eofset.reshape([nmodes, np.prod(eofset.shape[1:], dtype=np.int)])
#     refeofset = refeofset.reshape([nmodes,
#                                    np.prod(refeofset.shape[1:],
#                                            dtype=np.int)])
#     for mode in range(nmodes):
#         i = 0
#         try:
#             while _close(eofset[mode, i], 0.) or \
#                   _close(refeofset[mode, i], 0.) \
#                   or np.ma.is_masked(eofset[mode, i]) or \
#                   np.ma.is_masked(refeofset[mode, i]):
#                 i += 1
#         except IndexError:
#             i = 0
#         if np.sign(eofset[mode, i]) != np.sign(refeofset[mode, i]):
#             signs[mode] = -1
#     return signs.reshape(shape)
# 
# Path: lib/eofs/tests/reference.py
# def reference_solution(container_type, weights):
#     """Obtain a reference EOF analysis solution.
# 
#     **Arguments:**
# 
#     *container_type*
#         Either 'standard', 'cdms', 'iris' or 'xarray'.
# 
#     *weights*
#         Weights method. One of 'equal', 'latitude', or 'area'.
# 
#     """
#     container_type = container_type.lower()
#     weights = weights.lower()
#     if container_type not in ('standard', 'iris', 'cdms', 'xarray'):
#         raise ValueError("unknown container type "
#                          "'{!s}'".format(container_type))
#     solution = _read_reference_solution(weights)
#     time_units = 'months since 0-1-1 00:00:0.0'
#     neofs = len(solution['eigenvalues'])
#     _get_wrapper(container_type)(solution, neofs, time_units)
#     return solution


# Path: lib/eofs/tests/test_solution.py
import numpy as np
import numpy.ma as ma
import pytest
import eofs
        import dask
        import dask
        import dask
        import dask
        import dask
    from iris.cube import Cube
from eofs.tests import EofsTest
from .utils import sign_adjustments
from .reference import reference_solution

    pass




# Create a mapping from interface name to solver class.
solvers = {'standard': eofs.standard.Eof}
try:
    solvers['cdms'] = eofs.cdms.Eof
except AttributeError:
    pass
try:
    solvers['iris'] = eofs.iris.Eof
except AttributeError:
    pass
try:
    solvers['xarray'] = eofs.xarray.Eof
except AttributeError:
    pass


class SolutionTest(EofsTest):
    """Base class for all solution test classes."""
    interface = None
    weights = None
    alternate_weights_arg = None

    @classmethod
    def setup_class(cls):
        try:

            cls.solution = reference_solution(cls.interface, cls.weights)