{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "74981034",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "c0afe3a1",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv('rgi7_per_glacier_5yr_10yr_20yr_rates.csv',index_col=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "22c27df6-11eb-44ff-9223-3c93c7fac3ff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['2000-01-01_2005-01-01', '2000-01-01_2010-01-01',\n",
       "       '2000-01-01_2020-01-01', '2005-01-01_2010-01-01',\n",
       "       '2010-01-01_2015-01-01', '2010-01-01_2020-01-01',\n",
       "       '2015-01-01_2020-01-01'], dtype=object)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.period.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "193425d4-10c7-4195-834b-655190c00dfc",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = df.loc[df.period.isin(['2000-01-01_2010-01-01', '2000-01-01_2020-01-01', '2010-01-01_2020-01-01'])]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "afb6df87-0c6e-497b-b371-b8260b7b35f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_parquet('hugonnet_2021_ds_rgi70_pergla_rates_10_20.parquet', \n",
    "              engine='pyarrow', compression='zstd')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e7256b76-db70-4d18-b81e-915ff23c9780",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "8d135c76-c4db-462b-be49-89b982a4aadc",
   "metadata": {},
   "outputs": [],
   "source": [
    "dfo = pd.read_hdf('hugonnet_2021_ds_rgi60_pergla_rates_10_20_worldwide_filled.hdf')\n",
    "dfo.to_parquet('hugonnet_2021_ds_rgi60_pergla_rates_10_20_worldwide_filled.parquet', \n",
    "               engine='pyarrow', compression='zstd')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9153c112-6a8e-4d3b-afdd-5e34d15d563b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "809905a0-2d9d-4deb-836f-d86a5c5e78d7",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "8ef55695-c968-4918-9a10-4b81c9757080",
   "metadata": {},
   "outputs": [],
   "source": [
    "dfo = pd.read_hdf('hugonnet_2021_ds_rgi70_pergla_rates_10_20.hdf')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "f81954c2-151f-44cf-a328-990d0fa82bf6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['2000-01-01_2010-01-01', '2000-01-01_2020-01-01',\n",
       "       '2010-01-01_2020-01-01'], dtype=object)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dfo.period.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "35d92fb6-7875-4ced-abea-aa5b0a91c529",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
