<jupyter_start><jupyter_text>Demo III - Visualization<jupyter_code>import pathlib
import sys

# define the top level directory
PROJECT_PATH = pathlib.Path("/media/disk/erc/papers/2019_ML_OCN/")
CODE_PATH = PROJECT_PATH.joinpath("ml4ocean")
sys.path.append(str(CODE_PATH))

# ml4ocean packages
from src.utils import get_paths
from src.data.world import get_full_data, world_features
from src.features.world import subset_independent_floats

PATHS = get_paths()

# standard pacakges
import numpy as np
import pandas as pd

# plottling
import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER

%matplotlib inline
%load_ext autoreload
%autoreload 2<jupyter_output>The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload<jupyter_text>Data<jupyter_code>!ls {PATHS.data_interim}
inputs_df = pd.read_csv(f"{PATHS.data_interim.joinpath('inputs.csv')}")
outputs_df = pd.read_csv(f"{PATHS.data_interim.joinpath('outputs.csv')}")
soca2016_df = pd.read_csv(f"{PATHS.data_interim.joinpath('soca2016.csv')}")
isprs2020_df = pd.read_csv(f"{PATHS.data_interim.joinpath('isprs2020.csv')}")<jupyter_output><empty_output><jupyter_text>Plot I - Float Locations<jupyter_code>soca2016_locations = soca2016_df.copy().reset_index()[['wmo', 'lat', 'lon']].drop_duplicates()
input_locations = inputs_df.copy().reset_index()[['wmo', 'lat', 'lon']].drop_duplicates()
isprs2020_locations = isprs2020_df.copy().reset_index()[['wmo', 'lat', 'lon']].drop_duplicates()<jupyter_output><empty_output><jupyter_text>First Attempt<jupyter_code>fig = plt.figure(figsize=(24, 12))

ax = plt.axes(projection=ccrs.Mollweide())

# SOCA2016
pts1 = plt.scatter(
    x=soca2016_locations.lon, 
    y=soca2016_locations.lat, 
    s=80,
    marker='+',
    color="darkorange",
    transform=ccrs.PlateCarree(),
    label='SOCA2016', zorder=3)
# ISPRS2020
pts2 = plt.scatter(
    x=isprs2020_locations.lon, 
    y=isprs2020_locations.lat, 
    s=80,
    marker='+',
    color="yellow",
    transform=ccrs.PlateCarree(),
    label='ISPRS2020', zorder=3,)
# INPUTS
pts3 = plt.scatter(
    x=input_locations.lon, 
    y=input_locations.lat, 
    s=50,
    marker='+',
    color="#528B8B",
    transform=ccrs.PlateCarree(),
    label='Input Data')


ax.coastlines()
ax.add_feature(cartopy.feature.LAND, zorder=0, facecolor='dimgray')
ax.add_feature(cartopy.feature.LAKES, zorder=1, facecolor='white', edgecolor='black')
ax.add_feature(cartopy.feature.RIVERS, zorder=2, edgecolor='black')

# gridlines
gl = ax.gridlines(
    crs=ccrs.PlateCarree(), 
    color='black', 
    alpha=0.9, 
    linewidth=1, 
    linestyle='--', 
    zorder=4
)

ax.legend(fontsize=30, ncol=2, markerscale=3, loc='upper right')
plt.tight_layout()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1443699258736322, 'fraction_numerical': 0.03565125308859866, 'mean_word_length': 5.997530864197531, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '487560', 'license': 'MIT', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1087, 'n_words': 164, 'path': 'notebooks/global_data/3_visualization.ipynb', 'repo_name': 'IPL-UV/ml4ocean', 'size': '2833'}