"csrc/cuda/spspmm_kernel.cu" did not exist on "f9b000930b47a7c76492dbed7f51842bcf067ef1"
analyze.ipynb 2.93 KB
Newer Older
mashun1's avatar
veros  
mashun1 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import xarray as xr\n",
    "import numpy as np\n",
    "import cmocean"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "OUTPUT_FILES = {\n",
    "    \"snapshot\": \"acc.snapshot.nc\",\n",
    "    \"averages\": \"acc.averages.nc\",\n",
    "    \"overturning\": \"acc.overturning.nc\",\n",
    "    \"energy\": \"acc.energy.nc\",\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ds_avg = xr.open_dataset(OUTPUT_FILES[\"averages\"])\n",
    "ds_avg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ds_avg[\"psi\"] = ds_avg.psi / 1e6\n",
    "ds_avg[\"psi\"].attrs[\"units\"] = \"Sv\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ds_avg[\"psi\"].isel(Time=-1).plot.contourf(levels=50, cmap=\"cmo.balance\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "(\n",
    "    ds_avg[\"salt\"]\n",
    "    .isel(Time=slice(-1,None))\n",
    "    .mean(dim=(\"Time\", \"xt\"))\n",
    "    .plot.contourf(levels=50, cmap=\"cmo.haline\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ds_snap = xr.open_dataset(OUTPUT_FILES[\"snapshot\"])\n",
    "weights = ds_snap[\"area_t\"].fillna(0)\n",
    "\n",
    "temp_weighted = (\n",
    "    ds_avg[\"temp\"]\n",
    "    .isel(Time=-1)\n",
    "    .weighted(weights)\n",
    "    .mean(dim=\"yt\")\n",
    "    .plot.contourf(vmin=-2, vmax=22, levels=25, cmap=\"cmo.thermal\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ds_ovr = xr.open_dataset(OUTPUT_FILES[\"overturning\"])\n",
    "\n",
    "ds_ovr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ds_ovr[\"vsf_depth\"] = ds_ovr.vsf_depth / 1e6\n",
    "\n",
    "ds_ovr.vsf_depth.attrs[\"long_name\"] = \"MOC\"\n",
    "\n",
    "ds_ovr.vsf_depth.attrs[\"units\"] = \"Sv\"\n",
    "\n",
    "ds_ovr.vsf_depth.isel(Time=-1).plot.contourf(levels=50, cmap=\"cmo.balance\")"
   ]
  }
 ],
 "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.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}