# Path: atrain_match/cloudproducts/read_oca.py
# OCA_READ_EXTRA = OCA_READ_EXTRA_ONLY_OCA + ['flag_cm']


import numpy as np
import logging
import os
from atrain_match.cloudproducts.read_oca import OCA_READ_EXTRA
    from atrain_match.utils.pps_prototyping_util import (get_coldest_values,
                                                         get_darkest_values,
                                                         get_warmest_values)
    from atrain_match.utils.pps_prototyping_util import add_cnn_features
#
# This file is part of atrain_match.
#
# atrain_match is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# atrain_match is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with atrain_match.  If not, see <http://www.gnu.org/licenses/>.
logger = logging.getLogger(__name__)

def get_data_from_array(array, matched):
    if array is None:
        return None
    return np.array([array[matched['row'][idx], matched['col'][idx]]
                     for idx in range(matched['row'].shape[0])])


def get_data_from_array_nneigh(array, matched):
    if array is None:
        return None
    out = np.zeros(matched['row'].shape)
    for i in range(matched['row'].shape[1]):
        nodata = matched['row'][:, i] < 0

# Path: atrain_match/cloudproducts/read_oca.py
# OCA_READ_EXTRA = OCA_READ_EXTRA_ONLY_OCA + ['flag_cm']


# Path: atrain_match/libs/extract_imager_along_track.py
import numpy as np
import logging
import os
from atrain_match.cloudproducts.read_oca import OCA_READ_EXTRA
    from atrain_match.utils.pps_prototyping_util import (get_coldest_values,
                                                         get_darkest_values,
                                                         get_warmest_values)
    from atrain_match.utils.pps_prototyping_util import add_cnn_features

#
# This file is part of atrain_match.
#
# atrain_match is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# atrain_match is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with atrain_match.  If not, see <http://www.gnu.org/licenses/>.
logger = logging.getLogger(__name__)

def get_data_from_array(array, matched):
    if array is None:
        return None
    return np.array([array[matched['row'][idx], matched['col'][idx]]
                     for idx in range(matched['row'].shape[0])])


def get_data_from_array_nneigh(array, matched):
    if array is None:
        return None
    out = np.zeros(matched['row'].shape)
    for i in range(matched['row'].shape[1]):
        nodata = matched['row'][:, i] < 0

        matched_i = {'row': matched['row'][:, i].copy(),