{ "cells": [ { "cell_type": "markdown", "id": "ffb061e6-cc06-4f01-8c58-46bbe14127eb", "metadata": {}, "source": [ "# Visualization of a graph" ] }, { "cell_type": "markdown", "id": "491c6106-d2af-40ef-97ad-a607175f16fb", "metadata": {}, "source": [ "## Data preparation" ] }, { "cell_type": "code", "execution_count": 1, "id": "8d9022ae-26e3-4686-92df-7d896e7a8c3c", "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "\n", "import GraphEM\n", "import pyleoclim as pyleo" ] }, { "cell_type": "code", "execution_count": 2, "id": "8e94c7bb-294d-4133-b1f1-1fcffec772a1", "metadata": {}, "outputs": [], "source": [ "job = GraphEM.ReconJob()" ] }, { "cell_type": "code", "execution_count": 3, "id": "3642c07f-958d-4169-8276-8e5b6320d0d7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m\u001b[36mGraphEM: job.load_configs() >>> loading reconstruction configurations from: ./testcases/PPE_PAGES2k/configs.yml\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.load_configs() >>> job.configs created\u001b[0m\n", "\u001b[1m\u001b[36mGraphEM: job.load_configs() >>> job.configs[\"job_dirpath\"] = /Users/fzhu/Github/GraphEM/docsrc/tutorial/testcases/PPE_PAGES2k/recon\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.load_configs() >>> /Users/fzhu/Github/GraphEM/docsrc/tutorial/testcases/PPE_PAGES2k/recon created\u001b[0m\n", "{'anom_period': [1951, 1980],\n", " 'calib_period': [1900, 2000],\n", " 'job_dirpath': '/Users/fzhu/Github/GraphEM/docsrc/tutorial/testcases/PPE_PAGES2k/recon',\n", " 'job_id': 'GraphEM_tutorial',\n", " 'obs_path': {'tas': './data/obs/iCESM_ann.nc'},\n", " 'obs_regrid_ntrunc': 21,\n", " 'obs_varname': {'lat': 'lat', 'lon': 'lon', 'tas': 'tas'},\n", " 'proxydb_path': './data/proxy/pseudoPAGES2k_dataset_tas_wn_SNR10_full_temporal_availability.pkl',\n", " 'ptype_list': 'all',\n", " 'recon_period': [1000, 2000]}\n" ] } ], "source": [ "job.load_configs('./testcases/PPE_PAGES2k/configs.yml', verbose=True)" ] }, { "cell_type": "code", "execution_count": 6, "id": "7253f25d-01ab-4004-9386-4435cf6616d4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m\u001b[36mGraphEM: job.load_proxydb() >>> job.configs[\"proxydb_path\"] = /Users/fzhu/Github/GraphEM/docsrc/tutorial/testcases/PPE_PAGES2k/data/proxy/pseudoPAGES2k_dataset_tas_wn_SNR10_full_temporal_availability.pkl\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.load_proxydb() >>> 692 records loaded\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.load_proxydb() >>> job.proxydb created\u001b[0m\n" ] } ], "source": [ "job.load_proxydb(verbose=True)" ] }, { "cell_type": "code", "execution_count": 7, "id": "44950a26-67b7-4d65-a65b-9faef10d3d20", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m\u001b[36mGraphEM: job.load_obs() >>> loading instrumental observation fields from: {'tas': '/Users/fzhu/Github/GraphEM/docsrc/tutorial/testcases/PPE_PAGES2k/data/obs/iCESM_ann.nc'}\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.load_obs() >>> job.obs created\u001b[0m\n", "\u001b[1m\u001b[30mLMRt: job.regrid_obs() >>> regridded obs\u001b[0m\n", "Dataset Overview\n", "-----------------------\n", "\n", " Name: tas\n", " Source: /Users/fzhu/Github/GraphEM/docsrc/tutorial/testcases/PPE_PAGES2k/data/obs/iCESM_ann.nc\n", " Shape: time:1156, lat:22, lon:33\n", "\u001b[1m\u001b[32mLMRt: job.regrid_obs() >>> job.obs updated\u001b[0m\n" ] } ], "source": [ "job.load_obs(verbose=True)\n", "job.regrid_obs(verbose=True)" ] }, { "cell_type": "code", "execution_count": 8, "id": "fc1cfc2f-d8cf-4353-b706-0df2d739b12f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m\u001b[32mGraphEM: job.prep_data() >>> job.recon_time created\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.prep_data() >>> job.calib_time created\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.prep_data() >>> job.calib_idx created\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.prep_data() >>> job.temp created\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.prep_data() >>> job.df_proxy created\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.prep_data() >>> job.proxy created\u001b[0m\n", "\u001b[1m\u001b[32mGraphEM: job.prep_data() >>> job.lonlat created\u001b[0m\n" ] } ], "source": [ "job.prep_data(verbose=True)" ] }, { "cell_type": "code", "execution_count": 9, "id": "86756428-1d71-4cfa-a9c1-4879b8fc8503", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(1418, 2)\n", "726\n" ] } ], "source": [ "import numpy as np\n", "print(np.shape(job.lonlat))\n", "print(22*33)" ] }, { "cell_type": "code", "execution_count": 10, "id": "7a84f1cb-a576-4bd2-af36-480bc17bf30e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | NAm_153 | \n", "Asi_245 | \n", "NAm_165 | \n", "Asi_178 | \n", "Asi_174 | \n", "Eur_016 | \n", "Asi_198 | \n", "NAm_145 | \n", "Arc_070 | \n", "Arc_071 | \n", "... | \n", "Asi_119 | \n", "Ocn_153 | \n", "NAm_074 | \n", "Asi_026 | \n", "Ocn_169 | \n", "Asi_201 | \n", "Asi_179 | \n", "Arc_014 | \n", "Ocn_071 | \n", "Ocn_072 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1000.0 | \n", "2.049447 | \n", "1.206348 | \n", "-0.028154 | \n", "0.354423 | \n", "0.164291 | \n", "0.700894 | \n", "0.420136 | \n", "1.610386 | \n", "1.250028 | \n", "1.241505 | \n", "... | \n", "0.828330 | \n", "0.074526 | \n", "1.969163 | \n", "0.165617 | \n", "0.331053 | \n", "-0.578854 | \n", "0.188152 | \n", "1.255906 | \n", "0.304311 | \n", "0.425676 | \n", "
1001.0 | \n", "0.014990 | \n", "0.708525 | \n", "0.246777 | \n", "-0.057988 | \n", "-0.127694 | \n", "-0.077910 | \n", "0.477898 | \n", "-1.579350 | \n", "-1.453855 | \n", "1.689047 | \n", "... | \n", "0.986828 | \n", "-0.319637 | \n", "1.589055 | \n", "0.146957 | \n", "-0.345228 | \n", "-0.449773 | \n", "0.128710 | \n", "1.697772 | \n", "-0.457480 | \n", "-0.352040 | \n", "
1002.0 | \n", "-1.114598 | \n", "-0.355595 | \n", "-0.903415 | \n", "-0.370463 | \n", "-0.170471 | \n", "0.018887 | \n", "0.820904 | \n", "0.335598 | \n", "0.658790 | \n", "-1.006825 | \n", "... | \n", "-0.571258 | \n", "-0.268028 | \n", "-2.308910 | \n", "0.313561 | \n", "-0.265528 | \n", "-0.357028 | \n", "0.152346 | \n", "-0.037280 | \n", "-0.357438 | \n", "-0.312209 | \n", "
1003.0 | \n", "0.921028 | \n", "0.761262 | \n", "-0.241008 | \n", "-0.612394 | \n", "-0.198821 | \n", "0.600541 | \n", "0.038012 | \n", "1.649567 | \n", "0.484537 | \n", "-0.694430 | \n", "... | \n", "0.332292 | \n", "0.469818 | \n", "1.270690 | \n", "-0.172501 | \n", "0.210101 | \n", "-0.619913 | \n", "-0.157362 | \n", "-0.393430 | \n", "0.248620 | \n", "0.292726 | \n", "
1004.0 | \n", "0.292958 | \n", "-0.005126 | \n", "0.781568 | \n", "-0.169216 | \n", "0.314034 | \n", "-0.194410 | \n", "0.990756 | \n", "-0.391326 | \n", "-1.263733 | \n", "1.176845 | \n", "... | \n", "0.160528 | \n", "-0.084175 | \n", "0.971972 | \n", "0.342813 | \n", "-0.134291 | \n", "1.254460 | \n", "0.379938 | \n", "1.061491 | \n", "-0.126194 | \n", "-0.164533 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
1996.0 | \n", "0.596161 | \n", "0.397911 | \n", "-0.213472 | \n", "-0.375964 | \n", "0.110367 | \n", "-0.175807 | \n", "1.092398 | \n", "2.554041 | \n", "2.983670 | \n", "-0.233084 | \n", "... | \n", "0.086505 | \n", "0.938570 | \n", "-0.516218 | \n", "0.099238 | \n", "0.489292 | \n", "0.470537 | \n", "-0.122144 | \n", "-0.671030 | \n", "0.416049 | \n", "0.440858 | \n", "
1997.0 | \n", "0.708165 | \n", "-0.204674 | \n", "0.940863 | \n", "-0.811482 | \n", "-0.402413 | \n", "0.229789 | \n", "1.386490 | \n", "0.106067 | \n", "-0.278486 | \n", "-0.677213 | \n", "... | \n", "-0.236382 | \n", "0.109457 | \n", "-0.916285 | \n", "-0.319777 | \n", "-0.009780 | \n", "0.513189 | \n", "-0.707492 | \n", "-1.106939 | \n", "-0.174881 | \n", "-0.218647 | \n", "
1998.0 | \n", "0.502749 | \n", "-0.240407 | \n", "1.346490 | \n", "0.595868 | \n", "0.373318 | \n", "0.085835 | \n", "0.838359 | \n", "0.328611 | \n", "1.795783 | \n", "2.179380 | \n", "... | \n", "-0.454328 | \n", "0.489631 | \n", "0.177895 | \n", "0.388473 | \n", "0.009699 | \n", "0.821627 | \n", "0.307725 | \n", "1.840054 | \n", "-0.005446 | \n", "0.060198 | \n", "
1999.0 | \n", "1.476074 | \n", "-0.101115 | \n", "0.071156 | \n", "0.010010 | \n", "0.215712 | \n", "-0.452304 | \n", "-0.450495 | \n", "2.144862 | \n", "1.877791 | \n", "-0.456210 | \n", "... | \n", "0.340616 | \n", "0.543951 | \n", "0.590506 | \n", "0.229498 | \n", "0.373771 | \n", "0.036311 | \n", "-0.097946 | \n", "-0.597891 | \n", "0.509028 | \n", "0.404405 | \n", "
2000.0 | \n", "-0.227916 | \n", "-0.418627 | \n", "0.600212 | \n", "1.064158 | \n", "0.782957 | \n", "1.423108 | \n", "1.178986 | \n", "-0.110369 | \n", "1.205325 | \n", "-0.306477 | \n", "... | \n", "-0.156622 | \n", "0.445898 | \n", "0.449710 | \n", "0.121985 | \n", "0.304760 | \n", "1.010402 | \n", "0.186142 | \n", "1.766690 | \n", "0.499660 | \n", "0.453703 | \n", "
1001 rows × 692 columns
\n", "