<jupyter_start><jupyter_text>Analysis<jupyter_code>aso_mask = load_aso_depth().mask
hillshade_snow_on, hillshade_snow_free = load_hillshade(aso_mask)
df = pd.DataFrame({
        'sfm_snow_depth': load_sfm_depth(aso_mask).ravel(),
        'hillshade_snow_on': hillshade_snow_on.ravel(),
        'hillshade_snow_free': hillshade_snow_free.ravel(),
        'casi_class': load_classifier_data(aso_mask).ravel(),
})

df.dropna(inplace=True, how='any', subset=['sfm_snow_depth'])
df['casi_class'] = pd.cut(df['casi_class'], CASI_MAPPING, labels=CASI_CLASSES)

positive_sfm = query_helpers.get_positive(df, 'sfm_snow_depth')
negative_sfm = query_helpers.get_negative(df, 'sfm_snow_depth')

vegetation = ((negative_sfm.casi_class == 'Vegetation') | (negative_sfm.casi_class == 'Water'))
open_areas = ~vegetation

HILLSHADE_MIN = 0
HILLSHADE_MAX = 255

hillshade_range = np.arange(HILLSHADE_MIN, HILLSHADE_MAX + 1, 1)
min_depth = math.floor(negative_sfm.sfm_snow_depth.min())
bins = np.arange(min_depth, 0.5, 0.5)
def compare_column(data, column, title):
    plot_data = data
    plot_group = plot_data.groupby(column)
    plot_data_median = plot_group.median()
    plot_data_count = plot_group.count()

    data = [
        plot_data[column],
        plot_data.sfm_snow_depth,
        plot_data_median.index, 
        plot_data_median.sfm_snow_depth,
        plot_data_count.index, 
        plot_data_count.sfm_snow_depth,
    ]
    
    fig, (ax1, ax2) = plt.subplots(
        2, 1, sharex=True, 
        figsize=(8,10), gridspec_kw={ 'hspace': 0.05}, 
    )

    ax1.set_facecolor('whitesmoke')
    ax1.set_facecolor('whitesmoke')
    ha = ax1.hist2d(
        data[0], data[1], 
        bins=[hillshade_range, bins],
        vmin=0,
        vmax=500,
        cmin=1,
    )
    PlotBase.insert_colorbar(ax1, ha[3], 'Count', right=0.9, rect=[0.91, 0.508, 0.03, 0.368])
    ax1.set_ylabel(SNOW_DEPTH_LABEL)
    ax1.set_title(title)

    data_ax2 = ax2.scatter(data[2], data[3], label='Median', s=2)
    ax2.set_ylabel(r'Median $\Delta m$')
    ax2.set_xlim(HILLSHADE_MIN, HILLSHADE_MAX)
    ax2.set_xlabel('Hillshade')

    ax2_2 = ax2.twinx()

    data_ax2_2 = ax2_2.scatter(data[4], data[5], label='Count', color='indigo', s=2)
    PlotBase.format_axes_scientific(ax2_2, 'y', (4, 4))
    
    data = [data_ax2, data_ax2_2]
    labels = [l.get_label() for l in data]
    ax2.legend(data, labels);<jupyter_output><empty_output><jupyter_text>Negative values in vegetation Snow Free scene__0__ - Full shade__255__ - No shade<jupyter_code>compare_column(negative_sfm[vegetation], 'hillshade_snow_free', 'Negative Snow Free Hillshade');<jupyter_output><empty_output><jupyter_text>Snow On<jupyter_code>compare_column(negative_sfm[vegetation], 'hillshade_snow_on', 'Negative Snow On Hillshade');<jupyter_output><empty_output><jupyter_text>Hillshade comparison (No Vegetation) Snow free<jupyter_code>compare_column(negative_sfm[open_areas], 'hillshade_snow_free', 'Negative Snow Free Hillshade');<jupyter_output><empty_output><jupyter_text>Snow On<jupyter_code>compare_column(negative_sfm[open_areas], 'hillshade_snow_on', 'Negative Snow On Hillshade');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13356488790653614, 'fraction_numerical': 0.02557625513103884, 'mean_word_length': 5.0806142034548945, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '281904', 'license': 'MIT', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1273, 'n_words': 172, 'path': 'notebooks/Differences_with_hillshade.ipynb', 'repo_name': 'jomey/raster_compare', 'size': '3167'}