# Path: atrain_match/libs/extract_imager_along_track.py
# 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])])
# 
# Path: atrain_match/config.py
# NODATA = -9


from atrain_match.libs.extract_imager_along_track import get_data_from_array
from atrain_match.config import NODATA
    from atrain_match.libs.truth_imager_match import find_main_cloudproduct_file
    from pyhdf.SD import SD, SDC
import numpy as np
import os
import h5py
import logging
    modis_06.lwp = h4file.select('Cloud_Water_Path').get()
    modis_06.multilayer = h4file.select('Cloud_Multi_Layer_Flag').get()
    modis_06.optical_depth = h4file.select('Cloud_Optical_Thickness').get()
    modis_06.cloud_emissivity = h4file.select('cloud_emissivity_1km').get().astype(np.float)
    modis_06.cloud_phase = h4file.select('Cloud_Phase_Infrared_1km').get().astype(np.int)
    modis_06.latitude = h4file.select('Latitude').get().astype(np.float)
    modis_06.longitude = h4file.select('Longitude').get().astype(np.float)

    h_gain = h4file.select('cloud_top_height_1km').attributes()['scale_factor']
    h_intercept = h4file.select('cloud_top_height_1km').attributes()['add_offset']
    t_gain = h4file.select('cloud_top_temperature_1km').attributes()['scale_factor']
    t_intercept = h4file.select('cloud_top_temperature_1km').attributes()['add_offset']
    p_gain = h4file.select('cloud_top_pressure_1km').attributes()['scale_factor']
    p_intercept = h4file.select('cloud_top_pressure_1km').attributes()['add_offset']
    h_nodata = h4file.select('cloud_top_height_1km').attributes()['_FillValue']
    t_nodata = h4file.select('cloud_top_temperature_1km').attributes()['_FillValue']
    p_nodata = h4file.select('cloud_top_pressure_1km').attributes()['_FillValue']

    lwp_gain = h4file.select('Cloud_Water_Path').attributes()['scale_factor']
    lwp_intercept = h4file.select('Cloud_Water_Path').attributes()['add_offset']
    lwp_nodata = h4file.select('Cloud_Water_Path').attributes()['_FillValue']

    od_gain = h4file.select('Cloud_Optical_Thickness').attributes()['scale_factor']
    od_intercept = h4file.select('Cloud_Optical_Thickness').attributes()['add_offset']
    od_nodata = h4file.select('Cloud_Optical_Thickness').attributes()['_FillValue']

    hmask = modis_06.height == h_nodata
    tmask = modis_06.temperature == t_nodata
    pmask = modis_06.pressure == p_nodata
    lwpmask = modis_06.lwp == lwp_nodata

# Path: atrain_match/libs/extract_imager_along_track.py
# 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])])
# 
# Path: atrain_match/config.py
# NODATA = -9


# Path: atrain_match/cloudproducts/read_modis_products.py
from atrain_match.libs.extract_imager_along_track import get_data_from_array
from atrain_match.config import NODATA
    from atrain_match.libs.truth_imager_match import find_main_cloudproduct_file
    from pyhdf.SD import SD, SDC
import numpy as np
import os
import h5py
import logging

    modis_06.lwp = h4file.select('Cloud_Water_Path').get()
    modis_06.multilayer = h4file.select('Cloud_Multi_Layer_Flag').get()
    modis_06.optical_depth = h4file.select('Cloud_Optical_Thickness').get()
    modis_06.cloud_emissivity = h4file.select('cloud_emissivity_1km').get().astype(np.float)
    modis_06.cloud_phase = h4file.select('Cloud_Phase_Infrared_1km').get().astype(np.int)
    modis_06.latitude = h4file.select('Latitude').get().astype(np.float)
    modis_06.longitude = h4file.select('Longitude').get().astype(np.float)

    h_gain = h4file.select('cloud_top_height_1km').attributes()['scale_factor']
    h_intercept = h4file.select('cloud_top_height_1km').attributes()['add_offset']
    t_gain = h4file.select('cloud_top_temperature_1km').attributes()['scale_factor']
    t_intercept = h4file.select('cloud_top_temperature_1km').attributes()['add_offset']
    p_gain = h4file.select('cloud_top_pressure_1km').attributes()['scale_factor']
    p_intercept = h4file.select('cloud_top_pressure_1km').attributes()['add_offset']
    h_nodata = h4file.select('cloud_top_height_1km').attributes()['_FillValue']
    t_nodata = h4file.select('cloud_top_temperature_1km').attributes()['_FillValue']
    p_nodata = h4file.select('cloud_top_pressure_1km').attributes()['_FillValue']

    lwp_gain = h4file.select('Cloud_Water_Path').attributes()['scale_factor']
    lwp_intercept = h4file.select('Cloud_Water_Path').attributes()['add_offset']
    lwp_nodata = h4file.select('Cloud_Water_Path').attributes()['_FillValue']

    od_gain = h4file.select('Cloud_Optical_Thickness').attributes()['scale_factor']
    od_intercept = h4file.select('Cloud_Optical_Thickness').attributes()['add_offset']
    od_nodata = h4file.select('Cloud_Optical_Thickness').attributes()['_FillValue']

    hmask = modis_06.height == h_nodata
    tmask = modis_06.temperature == t_nodata
    pmask = modis_06.pressure == p_nodata
    lwpmask = modis_06.lwp == lwp_nodata

    odmask = modis_06.optical_depth == od_nodata