<commit_before>const ee = require('ee')

const toDateComposite = collection => {
    const mosaic = collection.qualityMosaic('quality')
    const ratio = mosaic.select('VV').subtract(mosaic.select('VH')).rename('ratio_VV_VH')
    return mosaic.addBands(ratio)
}

const toTimeScan = collection => {
    let reduced = collection
        .select(['VV', 'VH'])
        .map(function (image) {
            return image.addBands(
                ee.Image(10).pow(image.divide(10)).rename(['VV_nat', 'VH_nat'])
            )
        })
        .reduce(
            ee.Reducer.minMax()
                .combine(ee.Reducer.mean(), '', true)
                .combine(ee.Reducer.stdDev(), '', true)
                .combine(ee.Reducer.median(), '', true)
        )

    reduced = reduced
        .addBands(
            reduced.select('VV_median').subtract(reduced.select('VH_median')).rename('ratio_VV_median_VH_median')
        )
        .addBands(
            reduced.select('VV_stdDev').divide(reduced.select('VV_nat_mean')).log10().multiply(10).rename('VV_CV')
        )
        .addBands(
            reduced.select('VH_stdDev').divide(reduced.select('VH_nat_mean')).log10().multiply(10).rename('VH_CV')
        )

    return reduced.addBands(
        reduced.normalizedDifference(['VV_CV', 'VH_CV']).rename('NDCV')
    ).select([
        'VV_min', 'VV_max', 'VV_mean', 'VV_stdDev', 'VV_median', 'VH_min', 'VH_max', 'VH_mean', 'VH_stdDev', 'VH_median', 'ratio_VV_median_VH_median', 'VV_CV', 'VH_CV', 'NDCV'
    ]).float()
}
<commit_msg>Manually calculated normalized difference to calculate NDCV.<commit_after>const ee = require('ee')

const toDateComposite = collection => {
    const mosaic = collection.qualityMosaic('quality')
    const ratio = mosaic.select('VV').subtract(mosaic.select('VH')).rename('ratio_VV_VH')
    return mosaic.addBands(ratio)
}

const toTimeScan = collection => {
    let reduced = collection
        .select(['VV', 'VH'])
        .map(function (image) {
            return image.addBands(
                ee.Image(10).pow(image.divide(10)).rename(['VV_nat', 'VH_nat'])
            )
        })
        .reduce(
            ee.Reducer.minMax()
                .combine(ee.Reducer.mean(), '', true)
                .combine(ee.Reducer.stdDev(), '', true)
                .combine(ee.Reducer.median(), '', true)
        )

    reduced = reduced
        .addBands(
            reduced.select('VV_median').subtract(reduced.select('VH_median')).rename('ratio_VV_median_VH_median')
        )
        .addBands(
            reduced.select('VV_stdDev').divide(reduced.select('VV_nat_mean')).log10().multiply(10).rename('VV_CV')
        )
        .addBands(
            reduced.select('VH_stdDev').divide(reduced.select('VH_nat_mean')).log10().multiply(10).rename('VH_CV')
        )

    return reduced
        .addBands(
            ee.Image().expression('(i.VV_CV - i.VH_CV) / (i.VV_CV + i.VH_CV)', {i: reduced}).rename('NDCV')
        )
        .select([
            'VV_min', 'VV_max', 'VV_mean', 'VV_stdDev', 'VV_median', 'VH_min', 'VH_max', 'VH_mean', 'VH_stdDev', 'VH_median', 'ratio_VV_median_VH_median', 'VV_CV', 'VH_CV', 'NDCV'
        ])
        .float()
}

{'fraction_non_alphanumeric': 0.17347580138277813, 'fraction_numerical': 0.00754242614707731, 'mean_word_length': 2.5804274465691788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4905815', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1086, 'n_words': 139}