Get grid

Get grid#

The get_grid method returns an xarray.Dataset containing grid variables for a given model grid. It relies on a checkout of binary horizontal grid and topography files from the CESM inputdata repository. The vertical grid files are in the POP2-CESM repository in the input_templates directory; they are maintained separately as part of the pop-tools repository.

%matplotlib inline
import xarray as xr

import pop_tools

Get a dataset for the POP_tx0.v3 tripole grid.

ds = pop_tools.get_grid('POP_tx0.1v3')
ds.info()
Downloading file 'inputdata/ocn/pop/tx0.1v3/grid/horiz_grid_200709.ieeer8' from 'https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata/ocn/pop/tx0.1v2/grid/horiz_grid_200709.ieeer8' to '/home/docs/.pop_tools'.
/home/docs/checkouts/readthedocs.org/user_builds/pop-tools/conda/latest/lib/python3.9/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'svn-ccsm-inputdata.cgd.ucar.edu'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
  warnings.warn(
  0%|                                               | 0.00/484M [00:00<?, ?B/s]
  0%|                                       | 99.3k/484M [00:00<10:38, 758kB/s]
  0%|                                        | 181k/484M [00:00<10:14, 788kB/s]
  0%|                                        | 296k/484M [00:00<08:38, 933kB/s]
  0%|                                       | 411k/484M [00:00<07:59, 1.01MB/s]
  0%|                                       | 525k/484M [00:00<07:40, 1.05MB/s]
  0%|                                       | 640k/484M [00:00<07:27, 1.08MB/s]
  0%|                                       | 771k/484M [00:00<07:00, 1.15MB/s]
  0%|                                       | 919k/484M [00:00<06:28, 1.24MB/s]
  0%|                                      | 1.05M/484M [00:00<06:22, 1.26MB/s]
  0%|                                      | 1.20M/484M [00:01<06:04, 1.32MB/s]
  0%|                                      | 1.36M/484M [00:01<05:42, 1.41MB/s]
  0%|                                      | 1.52M/484M [00:01<05:27, 1.47MB/s]
  0%|▏                                     | 1.69M/484M [00:01<05:17, 1.52MB/s]
  0%|▏                                     | 1.87M/484M [00:01<05:01, 1.60MB/s]
  0%|▏                                     | 2.05M/484M [00:01<04:50, 1.66MB/s]
  0%|▏                                     | 2.25M/484M [00:01<04:36, 1.74MB/s]
  1%|▏                                     | 2.44M/484M [00:01<04:26, 1.80MB/s]
  1%|▏                                     | 2.64M/484M [00:01<04:20, 1.85MB/s]
  1%|▏                                     | 2.85M/484M [00:01<04:09, 1.93MB/s]
  1%|▏                                     | 3.06M/484M [00:02<04:02, 1.99MB/s]
  1%|▎                                     | 3.29M/484M [00:02<03:52, 2.07MB/s]
  1%|▎                                     | 3.52M/484M [00:02<03:45, 2.13MB/s]
  1%|▎                                     | 3.77M/484M [00:02<03:36, 2.21MB/s]
  1%|▎                                     | 4.02M/484M [00:02<03:30, 2.28MB/s]
  1%|▎                                     | 4.26M/484M [00:02<03:25, 2.33MB/s]
  1%|▎                                     | 4.52M/484M [00:02<03:19, 2.40MB/s]
  1%|▍                                     | 4.79M/484M [00:02<03:14, 2.46MB/s]
  1%|▍                                     | 5.06M/484M [00:02<03:08, 2.55MB/s]
  1%|▍                                     | 5.34M/484M [00:02<03:03, 2.61MB/s]
  1%|▍                                     | 5.62M/484M [00:03<02:59, 2.66MB/s]
  1%|▍                                     | 5.92M/484M [00:03<02:54, 2.74MB/s]
  1%|▍                                     | 6.23M/484M [00:03<02:48, 2.84MB/s]
  1%|▌                                     | 6.54M/484M [00:03<02:54, 2.74MB/s]
  1%|▌                                     | 6.87M/484M [00:03<02:45, 2.87MB/s]
  1%|▌                                     | 7.19M/484M [00:03<02:40, 2.98MB/s]
  2%|▌                                     | 7.52M/484M [00:03<02:35, 3.07MB/s]
  2%|▌                                     | 7.85M/484M [00:03<02:32, 3.12MB/s]
  2%|▋                                     | 8.19M/484M [00:03<02:28, 3.20MB/s]
  2%|▋                                     | 8.55M/484M [00:03<02:23, 3.30MB/s]
  2%|▋                                     | 8.91M/484M [00:04<02:20, 3.38MB/s]
  2%|▋                                     | 9.29M/484M [00:04<02:16, 3.47MB/s]
  2%|▊                                     | 9.65M/484M [00:04<02:15, 3.51MB/s]
  2%|▊                                     | 10.0M/484M [00:04<02:12, 3.58MB/s]
  2%|▊                                     | 10.4M/484M [00:04<02:09, 3.66MB/s]
  2%|▊                                     | 10.8M/484M [00:04<02:06, 3.73MB/s]
  2%|▉                                     | 11.2M/484M [00:04<02:04, 3.79MB/s]
  2%|▉                                     | 11.6M/484M [00:04<02:02, 3.85MB/s]
  2%|▉                                     | 12.0M/484M [00:04<01:59, 3.95MB/s]
  3%|▉                                     | 12.5M/484M [00:05<01:58, 3.99MB/s]
  3%|█                                     | 12.9M/484M [00:05<01:56, 4.05MB/s]
  3%|█                                     | 13.3M/484M [00:05<01:53, 4.14MB/s]
  3%|█                                     | 13.8M/484M [00:05<01:51, 4.22MB/s]
  3%|█                                     | 14.2M/484M [00:05<01:50, 4.27MB/s]
  3%|█▏                                    | 14.7M/484M [00:05<01:48, 4.34MB/s]
  3%|█▏                                    | 15.1M/484M [00:05<01:46, 4.40MB/s]
  3%|█▏                                    | 15.6M/484M [00:05<01:44, 4.48MB/s]
  3%|█▎                                    | 16.1M/484M [00:05<01:42, 4.55MB/s]
  3%|█▎                                    | 16.5M/484M [00:05<01:41, 4.60MB/s]
  4%|█▎                                    | 17.0M/484M [00:06<01:39, 4.67MB/s]
  4%|█▍                                    | 17.5M/484M [00:06<01:38, 4.74MB/s]
  4%|█▍                                    | 18.0M/484M [00:06<01:36, 4.81MB/s]
  4%|█▍                                    | 18.5M/484M [00:06<01:36, 4.83MB/s]
  4%|█▍                                    | 19.0M/484M [00:06<01:34, 4.90MB/s]
  4%|█▌                                    | 19.6M/484M [00:06<01:33, 4.98MB/s]
  4%|█▌                                    | 20.1M/484M [00:06<01:31, 5.05MB/s]
  4%|█▌                                    | 20.6M/484M [00:06<01:30, 5.10MB/s]
  4%|█▋                                    | 21.2M/484M [00:06<01:29, 5.18MB/s]
  4%|█▋                                    | 21.7M/484M [00:06<01:27, 5.27MB/s]
  5%|█▋                                    | 22.3M/484M [00:07<01:26, 5.33MB/s]
  5%|█▊                                    | 22.8M/484M [00:07<01:25, 5.39MB/s]
  5%|█▊                                    | 23.4M/484M [00:07<01:24, 5.46MB/s]
  5%|█▉                                    | 24.0M/484M [00:07<01:22, 5.57MB/s]
  5%|█▉                                    | 24.6M/484M [00:07<01:21, 5.60MB/s]
  5%|█▉                                    | 25.2M/484M [00:07<01:20, 5.66MB/s]
  5%|██                                    | 25.8M/484M [00:07<01:19, 5.77MB/s]
  5%|██                                    | 26.4M/484M [00:07<01:18, 5.83MB/s]
  6%|██                                    | 27.0M/484M [00:07<01:17, 5.92MB/s]
  6%|██▏                                   | 27.6M/484M [00:07<01:16, 5.95MB/s]
  6%|██▏                                   | 28.2M/484M [00:08<01:15, 6.00MB/s]
  6%|██▎                                   | 28.9M/484M [00:08<01:14, 6.09MB/s]
  6%|██▎                                   | 29.5M/484M [00:08<01:13, 6.16MB/s]
  6%|██▎                                   | 30.1M/484M [00:08<01:13, 6.21MB/s]
  6%|██▍                                   | 30.8M/484M [00:08<01:12, 6.26MB/s]
  6%|██▍                                   | 31.4M/484M [00:08<01:11, 6.32MB/s]
  7%|██▌                                   | 32.1M/484M [00:08<01:10, 6.39MB/s]
  7%|██▌                                   | 32.8M/484M [00:08<01:10, 6.44MB/s]
  7%|██▋                                   | 33.5M/484M [00:08<01:08, 6.54MB/s]
  7%|██▋                                   | 34.1M/484M [00:08<01:07, 6.63MB/s]
  7%|██▋                                   | 34.8M/484M [00:09<01:07, 6.69MB/s]
  7%|██▊                                   | 35.5M/484M [00:09<01:06, 6.73MB/s]
  7%|██▊                                   | 36.2M/484M [00:09<01:05, 6.81MB/s]
  8%|██▉                                   | 36.9M/484M [00:09<01:05, 6.87MB/s]
  8%|██▉                                   | 37.7M/484M [00:09<01:04, 6.94MB/s]
  8%|███                                   | 38.4M/484M [00:09<01:03, 7.03MB/s]
  8%|███                                   | 39.1M/484M [00:09<01:02, 7.07MB/s]
  8%|███▏                                  | 39.9M/484M [00:09<01:01, 7.17MB/s]
  8%|███▏                                  | 40.6M/484M [00:09<01:01, 7.25MB/s]
  9%|███▎                                  | 41.4M/484M [00:09<01:01, 7.23MB/s]
  9%|███▎                                  | 42.1M/484M [00:10<01:00, 7.30MB/s]
  9%|███▎                                  | 42.9M/484M [00:10<00:59, 7.46MB/s]
  9%|███▍                                  | 43.7M/484M [00:10<00:57, 7.61MB/s]
  9%|███▍                                  | 44.5M/484M [00:10<00:56, 7.77MB/s]
  9%|███▌                                  | 45.4M/484M [00:10<00:54, 8.00MB/s]
 10%|███▋                                  | 46.3M/484M [00:10<00:52, 8.26MB/s]
 10%|███▋                                  | 47.3M/484M [00:10<00:51, 8.53MB/s]
 10%|███▊                                  | 48.2M/484M [00:10<00:49, 8.78MB/s]
 10%|███▊                                  | 49.2M/484M [00:10<00:47, 9.12MB/s]
 10%|███▉                                  | 50.2M/484M [00:10<00:46, 9.41MB/s]
 11%|████                                  | 51.3M/484M [00:11<00:44, 9.73MB/s]
 11%|████                                  | 52.4M/484M [00:11<00:43, 10.0MB/s]
 11%|████▏                                 | 53.5M/484M [00:11<00:41, 10.3MB/s]
 11%|████▎                                 | 54.7M/484M [00:11<00:40, 10.7MB/s]
 12%|████▍                                 | 55.9M/484M [00:11<00:38, 11.0MB/s]
 12%|████▍                                 | 57.1M/484M [00:11<00:37, 11.4MB/s]
 12%|████▌                                 | 58.4M/484M [00:11<00:36, 11.8MB/s]
 12%|████▋                                 | 59.7M/484M [00:11<00:34, 12.2MB/s]
 13%|████▊                                 | 61.0M/484M [00:11<00:33, 12.6MB/s]
 13%|████▉                                 | 62.4M/484M [00:11<00:32, 12.9MB/s]
 13%|█████                                 | 63.9M/484M [00:12<00:31, 13.4MB/s]
 14%|█████▏                                | 65.4M/484M [00:12<00:30, 13.8MB/s]
 14%|█████▎                                | 66.9M/484M [00:12<00:29, 14.2MB/s]
 14%|█████▍                                | 68.5M/484M [00:12<00:28, 14.6MB/s]
 14%|█████▌                                | 70.1M/484M [00:12<00:27, 15.1MB/s]
 15%|█████▋                                | 71.8M/484M [00:12<00:26, 15.6MB/s]
 15%|█████▊                                | 73.5M/484M [00:12<00:25, 16.0MB/s]
 16%|█████▉                                | 75.3M/484M [00:12<00:24, 16.5MB/s]
 16%|██████                                | 77.1M/484M [00:12<00:24, 16.9MB/s]
 16%|██████▏                               | 78.9M/484M [00:13<00:23, 17.3MB/s]
 17%|██████▎                               | 80.9M/484M [00:13<00:22, 17.9MB/s]
 17%|██████▌                               | 82.9M/484M [00:13<00:21, 18.5MB/s]
 18%|██████▋                               | 84.9M/484M [00:13<00:20, 19.1MB/s]
 18%|██████▊                               | 87.0M/484M [00:13<00:20, 19.6MB/s]
 18%|███████                               | 89.2M/484M [00:13<00:19, 20.1MB/s]
 19%|███████▏                              | 91.4M/484M [00:13<00:18, 20.7MB/s]
 19%|███████▎                              | 93.7M/484M [00:13<00:18, 21.2MB/s]
 20%|███████▌                              | 96.0M/484M [00:13<00:17, 21.9MB/s]
 20%|███████▋                              | 98.4M/484M [00:13<00:17, 22.4MB/s]
 21%|████████▏                              | 101M/484M [00:14<00:16, 23.1MB/s]
 21%|████████▎                              | 103M/484M [00:14<00:16, 23.6MB/s]
 22%|████████▌                              | 106M/484M [00:14<00:15, 24.3MB/s]
 22%|████████▊                              | 109M/484M [00:14<00:15, 24.9MB/s]
 23%|████████▉                              | 111M/484M [00:14<00:14, 25.5MB/s]
 24%|█████████▏                             | 114M/484M [00:14<00:14, 26.2MB/s]
 24%|█████████▍                             | 117M/484M [00:14<00:13, 27.0MB/s]
 25%|█████████▋                             | 120M/484M [00:14<00:13, 27.6MB/s]
 25%|█████████▉                             | 123M/484M [00:14<00:12, 28.2MB/s]
 26%|██████████▏                            | 126M/484M [00:14<00:12, 28.9MB/s]
 27%|██████████▍                            | 129M/484M [00:15<00:11, 29.6MB/s]
 27%|██████████▋                            | 133M/484M [00:15<00:11, 30.4MB/s]
 28%|██████████▉                            | 136M/484M [00:15<00:11, 31.1MB/s]
 29%|███████████▏                           | 139M/484M [00:15<00:10, 31.8MB/s]
 30%|███████████▌                           | 143M/484M [00:15<00:10, 32.7MB/s]
 30%|███████████▊                           | 146M/484M [00:15<00:10, 33.5MB/s]
 31%|████████████                           | 150M/484M [00:15<00:09, 34.4MB/s]
 32%|████████████▍                          | 154M/484M [00:15<00:09, 35.2MB/s]
 33%|████████████▋                          | 158M/484M [00:15<00:09, 36.0MB/s]
 33%|█████████████                          | 162M/484M [00:15<00:08, 36.8MB/s]
 34%|█████████████▎                         | 166M/484M [00:16<00:08, 37.7MB/s]
 35%|█████████████▋                         | 170M/484M [00:16<00:08, 38.6MB/s]
 36%|██████████████                         | 174M/484M [00:16<00:07, 39.4MB/s]
 37%|██████████████▎                        | 178M/484M [00:16<00:07, 40.4MB/s]
 38%|██████████████▋                        | 182M/484M [00:16<00:07, 41.3MB/s]
 39%|███████████████                        | 187M/484M [00:16<00:07, 42.2MB/s]
 40%|███████████████▍                       | 191M/484M [00:16<00:06, 43.1MB/s]
 41%|███████████████▊                       | 196M/484M [00:16<00:06, 44.0MB/s]
 42%|████████████████▏                      | 201M/484M [00:16<00:06, 45.0MB/s]
 43%|████████████████▌                      | 206M/484M [00:16<00:06, 46.0MB/s]
 44%|████████████████▉                      | 211M/484M [00:17<00:05, 46.8MB/s]
 45%|█████████████████▍                     | 216M/484M [00:17<00:05, 47.9MB/s]
 46%|█████████████████▊                     | 221M/484M [00:17<00:05, 48.9MB/s]
 47%|██████████████████▎                    | 227M/484M [00:17<00:05, 49.7MB/s]
 48%|██████████████████▋                    | 232M/484M [00:17<00:04, 50.9MB/s]
 49%|███████████████████▏                   | 238M/484M [00:17<00:04, 52.2MB/s]
 50%|███████████████████▌                   | 243M/484M [00:17<00:04, 53.3MB/s]
 51%|████████████████████                   | 249M/484M [00:17<00:04, 54.4MB/s]
 53%|████████████████████▌                  | 255M/484M [00:17<00:04, 55.5MB/s]
 54%|█████████████████████                  | 261M/484M [00:17<00:03, 56.7MB/s]
 55%|█████████████████████▌                 | 267M/484M [00:18<00:03, 57.9MB/s]
 56%|██████████████████████                 | 273M/484M [00:18<00:03, 59.2MB/s]
 58%|██████████████████████▌                | 280M/484M [00:18<00:03, 60.3MB/s]
 59%|███████████████████████                | 286M/484M [00:18<00:03, 61.8MB/s]
 61%|███████████████████████▌               | 293M/484M [00:18<00:03, 62.4MB/s]
 62%|████████████████████████▏              | 300M/484M [00:18<00:02, 63.4MB/s]
 63%|████████████████████████▋              | 306M/484M [00:18<00:02, 64.8MB/s]
 65%|█████████████████████████▎             | 313M/484M [00:18<00:02, 66.2MB/s]
 66%|█████████████████████████▊             | 321M/484M [00:18<00:02, 67.7MB/s]
 68%|██████████████████████████▍            | 328M/484M [00:18<00:02, 69.1MB/s]
 69%|███████████████████████████            | 335M/484M [00:19<00:02, 70.4MB/s]
 71%|███████████████████████████▋           | 343M/484M [00:19<00:01, 71.6MB/s]
 72%|████████████████████████████▏          | 350M/484M [00:19<00:01, 72.7MB/s]
 74%|████████████████████████████▊          | 358M/484M [00:19<00:01, 73.7MB/s]
 76%|█████████████████████████████▍         | 366M/484M [00:19<00:01, 74.9MB/s]
 77%|██████████████████████████████         | 374M/484M [00:19<00:01, 76.3MB/s]
 79%|██████████████████████████████▊        | 382M/484M [00:19<00:01, 77.8MB/s]
 81%|███████████████████████████████▍       | 390M/484M [00:19<00:01, 78.7MB/s]
 82%|████████████████████████████████       | 398M/484M [00:19<00:01, 79.8MB/s]
 84%|████████████████████████████████▊      | 406M/484M [00:19<00:00, 80.9MB/s]
 86%|█████████████████████████████████▍     | 415M/484M [00:20<00:00, 82.1MB/s]
 88%|██████████████████████████████████▏    | 424M/484M [00:20<00:00, 83.3MB/s]
 89%|██████████████████████████████████▊    | 432M/484M [00:20<00:00, 83.2MB/s]
 91%|███████████████████████████████████▍   | 440M/484M [00:20<00:00, 83.1MB/s]
 93%|████████████████████████████████████▏  | 448M/484M [00:20<00:00, 83.0MB/s]
 94%|████████████████████████████████████▊  | 457M/484M [00:20<00:00, 83.2MB/s]
 96%|█████████████████████████████████████▌ | 465M/484M [00:20<00:00, 83.6MB/s]
 98%|██████████████████████████████████████▏| 474M/484M [00:20<00:00, 83.0MB/s]
100%|██████████████████████████████████████▊| 482M/484M [00:20<00:00, 83.9MB/s]
  0%|                                               | 0.00/484M [00:00<?, ?B/s]
100%|███████████████████████████████████████| 484M/484M [00:00<00:00, 1.11TB/s]

Downloading file 'inputdata/ocn/pop/tx0.1v3/grid/topography_20170718.ieeei4' from 'https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata/ocn/pop/tx0.1v3/grid/topography_20170718.ieeei4' to '/home/docs/.pop_tools'.
/home/docs/checkouts/readthedocs.org/user_builds/pop-tools/conda/latest/lib/python3.9/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'svn-ccsm-inputdata.cgd.ucar.edu'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
  warnings.warn(
  0%|                                              | 0.00/34.6M [00:00<?, ?B/s]
  0%|                                      | 99.3k/34.6M [00:00<00:46, 746kB/s]
  1%|▏                                      | 181k/34.6M [00:00<00:44, 781kB/s]
  1%|▎                                      | 280k/34.6M [00:00<00:39, 864kB/s]
  1%|▍                                      | 378k/34.6M [00:00<00:37, 907kB/s]
  1%|▌                                      | 493k/34.6M [00:00<00:34, 988kB/s]
  2%|▋                                     | 607k/34.6M [00:00<00:32, 1.04MB/s]
  2%|▊                                     | 738k/34.6M [00:00<00:30, 1.12MB/s]
  3%|▉                                     | 869k/34.6M [00:00<00:28, 1.18MB/s]
  3%|█                                    | 1.02M/34.6M [00:00<00:26, 1.26MB/s]
  3%|█▏                                   | 1.16M/34.6M [00:01<00:25, 1.32MB/s]
  4%|█▍                                   | 1.31M/34.6M [00:01<00:24, 1.37MB/s]
  4%|█▌                                   | 1.46M/34.6M [00:01<00:23, 1.40MB/s]
  5%|█▊                                   | 1.64M/34.6M [00:01<00:21, 1.51MB/s]
  5%|█▉                                   | 1.80M/34.6M [00:01<00:21, 1.55MB/s]
  6%|██                                   | 1.98M/34.6M [00:01<00:20, 1.62MB/s]
  6%|██▎                                  | 2.16M/34.6M [00:01<00:19, 1.67MB/s]
  7%|██▌                                  | 2.36M/34.6M [00:01<00:18, 1.75MB/s]
  7%|██▋                                  | 2.56M/34.6M [00:01<00:17, 1.81MB/s]
  8%|██▉                                  | 2.77M/34.6M [00:01<00:16, 1.90MB/s]
  9%|███▏                                 | 2.98M/34.6M [00:02<00:16, 1.96MB/s]
  9%|███▍                                 | 3.20M/34.6M [00:02<00:15, 2.01MB/s]
 10%|███▋                                 | 3.43M/34.6M [00:02<00:14, 2.09MB/s]
 11%|███▉                                 | 3.67M/34.6M [00:02<00:14, 2.18MB/s]
 11%|████▏                                | 3.90M/34.6M [00:02<00:13, 2.21MB/s]
 12%|████▍                                | 4.15M/34.6M [00:02<00:13, 2.28MB/s]
 13%|████▋                                | 4.41M/34.6M [00:02<00:12, 2.37MB/s]
 14%|█████                                | 4.67M/34.6M [00:02<00:12, 2.44MB/s]
 14%|█████▎                               | 4.93M/34.6M [00:02<00:11, 2.49MB/s]
 15%|█████▌                               | 5.21M/34.6M [00:02<00:11, 2.57MB/s]
 16%|█████▉                               | 5.49M/34.6M [00:03<00:11, 2.63MB/s]
 17%|██████▏                              | 5.78M/34.6M [00:03<00:10, 2.71MB/s]
 18%|██████▌                              | 6.08M/34.6M [00:03<00:10, 2.78MB/s]
 18%|██████▊                              | 6.39M/34.6M [00:03<00:09, 2.86MB/s]
 19%|███████▏                             | 6.70M/34.6M [00:03<00:09, 2.92MB/s]
 20%|███████▌                             | 7.03M/34.6M [00:03<00:09, 3.01MB/s]
 21%|███████▉                             | 7.36M/34.6M [00:03<00:08, 3.08MB/s]
 22%|████████▏                            | 7.69M/34.6M [00:03<00:08, 3.12MB/s]
 23%|████████▌                            | 8.03M/34.6M [00:03<00:08, 3.20MB/s]
 24%|████████▉                            | 8.37M/34.6M [00:03<00:08, 3.26MB/s]
 25%|█████████▎                           | 8.73M/34.6M [00:04<00:07, 3.34MB/s]
 26%|█████████▋                           | 9.09M/34.6M [00:04<00:07, 3.40MB/s]
 27%|██████████                           | 9.45M/34.6M [00:04<00:07, 3.46MB/s]
 28%|██████████▌                          | 9.83M/34.6M [00:04<00:06, 3.54MB/s]
 30%|██████████▉                          | 10.2M/34.6M [00:04<00:06, 3.60MB/s]
 31%|███████████▎                         | 10.6M/34.6M [00:04<00:06, 3.65MB/s]
 32%|███████████▊                         | 11.0M/34.6M [00:04<00:06, 3.72MB/s]
 33%|████████████▏                        | 11.4M/34.6M [00:04<00:06, 3.64MB/s]
 34%|████████████▋                        | 11.8M/34.6M [00:04<00:06, 3.75MB/s]
 35%|█████████████                        | 12.2M/34.6M [00:05<00:05, 3.84MB/s]
 37%|█████████████▌                       | 12.6M/34.6M [00:05<00:05, 3.93MB/s]
 38%|█████████████▉                       | 13.0M/34.6M [00:05<00:05, 4.01MB/s]
 39%|██████████████▍                      | 13.5M/34.6M [00:05<00:05, 4.11MB/s]
 40%|██████████████▉                      | 13.9M/34.6M [00:05<00:04, 4.18MB/s]
 42%|███████████████▍                     | 14.4M/34.6M [00:05<00:04, 4.28MB/s]
 43%|███████████████▉                     | 14.8M/34.6M [00:05<00:04, 4.35MB/s]
 44%|████████████████▍                    | 15.3M/34.6M [00:05<00:04, 4.41MB/s]
 46%|████████████████▉                    | 15.8M/34.6M [00:05<00:04, 4.49MB/s]
 47%|█████████████████▍                   | 16.3M/34.6M [00:05<00:04, 4.56MB/s]
 48%|█████████████████▉                   | 16.7M/34.6M [00:06<00:03, 4.61MB/s]
 50%|██████████████████▍                  | 17.2M/34.6M [00:06<00:03, 4.67MB/s]
 51%|██████████████████▉                  | 17.7M/34.6M [00:06<00:03, 4.77MB/s]
 53%|███████████████████▌                 | 18.2M/34.6M [00:06<00:03, 4.84MB/s]
 54%|████████████████████                 | 18.7M/34.6M [00:06<00:03, 4.90MB/s]
 56%|████████████████████▋                | 19.3M/34.6M [00:06<00:03, 4.98MB/s]
 57%|█████████████████████▏               | 19.8M/34.6M [00:06<00:02, 5.03MB/s]
 59%|█████████████████████▊               | 20.3M/34.6M [00:06<00:02, 5.09MB/s]
 60%|██████████████████████▎              | 20.9M/34.6M [00:06<00:02, 5.15MB/s]
 62%|██████████████████████▉              | 21.4M/34.6M [00:06<00:02, 5.24MB/s]
 64%|███████████████████████▌             | 22.0M/34.6M [00:07<00:02, 5.28MB/s]
 65%|████████████████████████             | 22.5M/34.6M [00:07<00:02, 5.34MB/s]
 67%|████████████████████████▋            | 23.1M/34.6M [00:07<00:02, 5.43MB/s]
 68%|█████████████████████████▎           | 23.7M/34.6M [00:07<00:01, 5.49MB/s]
 70%|█████████████████████████▉           | 24.2M/34.6M [00:07<00:01, 5.56MB/s]
 72%|██████████████████████████▌          | 24.8M/34.6M [00:07<00:01, 5.64MB/s]
 73%|███████████████████████████▏         | 25.4M/34.6M [00:07<00:01, 5.68MB/s]
 75%|███████████████████████████▊         | 26.0M/34.6M [00:07<00:01, 5.76MB/s]
 77%|████████████████████████████▍        | 26.6M/34.6M [00:07<00:01, 5.82MB/s]
 79%|█████████████████████████████▏       | 27.2M/34.6M [00:07<00:01, 5.91MB/s]
 81%|█████████████████████████████▊       | 27.8M/34.6M [00:08<00:01, 5.95MB/s]
 82%|██████████████████████████████▍      | 28.5M/34.6M [00:08<00:01, 6.05MB/s]
 84%|███████████████████████████████▏     | 29.1M/34.6M [00:08<00:00, 6.12MB/s]
 86%|███████████████████████████████▊     | 29.8M/34.6M [00:08<00:00, 6.19MB/s]
 88%|████████████████████████████████▌    | 30.4M/34.6M [00:08<00:00, 6.24MB/s]
 90%|█████████████████████████████████▏   | 31.0M/34.6M [00:08<00:00, 6.31MB/s]
 92%|█████████████████████████████████▉   | 31.7M/34.6M [00:08<00:00, 6.37MB/s]
 94%|██████████████████████████████████▋  | 32.4M/34.6M [00:08<00:00, 6.42MB/s]
 96%|███████████████████████████████████▎ | 33.0M/34.6M [00:08<00:00, 6.50MB/s]
 98%|████████████████████████████████████ | 33.7M/34.6M [00:08<00:00, 6.58MB/s]
100%|████████████████████████████████████▊| 34.4M/34.6M [00:09<00:00, 6.66MB/s]
  0%|                                              | 0.00/34.6M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 34.6M/34.6M [00:00<00:00, 74.0GB/s]

Downloading file 'inputdata/ocn/pop/tx0.1v3/grid/region_mask_20170718.ieeei4' from 'https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata/ocn/pop/tx0.1v3/grid/region_mask_20170718.ieeei4' to '/home/docs/.pop_tools'.
/home/docs/checkouts/readthedocs.org/user_builds/pop-tools/conda/latest/lib/python3.9/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'svn-ccsm-inputdata.cgd.ucar.edu'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
  warnings.warn(
  0%|                                              | 0.00/34.6M [00:00<?, ?B/s]
  1%|▏                                     | 181k/34.6M [00:00<00:24, 1.39MB/s]
  2%|▊                                     | 728k/34.6M [00:00<00:09, 3.53MB/s]
  4%|█▌                                   | 1.49M/34.6M [00:00<00:07, 4.71MB/s]
  8%|██▊                                  | 2.62M/34.6M [00:00<00:04, 7.03MB/s]
 12%|████▍                                | 4.15M/34.6M [00:00<00:03, 9.79MB/s]
 17%|██████▏                              | 5.83M/34.6M [00:00<00:02, 11.1MB/s]
 24%|█████████                            | 8.46M/34.6M [00:00<00:01, 15.6MB/s]
 34%|████████████▋                        | 11.8M/34.6M [00:00<00:01, 21.0MB/s]
 44%|████████████████▎                    | 15.3M/34.6M [00:00<00:00, 25.1MB/s]
 55%|████████████████████▍                | 19.1M/34.6M [00:01<00:00, 28.9MB/s]
 67%|████████████████████████▉            | 23.2M/34.6M [00:01<00:00, 32.8MB/s]
 80%|█████████████████████████████▍       | 27.6M/34.6M [00:01<00:00, 35.8MB/s]
  0%|                                              | 0.00/34.6M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 34.6M/34.6M [00:00<00:00, 49.8GB/s]

xarray.Dataset {
dimensions:
	nlat = 2400 ;
	nlon = 3600 ;
	z_t = 62 ;
	z_w = 62 ;
	z_w_bot = 62 ;

variables:
	float64 TLAT(nlat, nlon) ;
		TLAT:units = degrees_north ;
		TLAT:long_name = T-grid latitude ;
	float64 TLONG(nlat, nlon) ;
		TLONG:units = degrees_east ;
		TLONG:long_name = T-grid longitude ;
	float64 ULAT(nlat, nlon) ;
		ULAT:units = degrees_north ;
		ULAT:long_name = U-grid latitude ;
	float64 ULONG(nlat, nlon) ;
		ULONG:units = degrees_east ;
		ULONG:long_name = U-grid longitude ;
	float64 DXT(nlat, nlon) ;
		DXT:units = cm ;
		DXT:long_name = x-spacing centered at T points ;
		DXT:coordinates = TLONG TLAT ;
	float64 DYT(nlat, nlon) ;
		DYT:units = cm ;
		DYT:long_name = y-spacing centered at T points ;
		DYT:coordinates = TLONG TLAT ;
	float64 DXU(nlat, nlon) ;
		DXU:units = cm ;
		DXU:long_name = x-spacing centered at U points ;
		DXU:coordinates = ULONG ULAT ;
	float64 DYU(nlat, nlon) ;
		DYU:units = cm ;
		DYU:long_name = y-spacing centered at U points ;
		DYU:coordinates = ULONG ULAT ;
	float64 TAREA(nlat, nlon) ;
		TAREA:units = cm^2 ;
		TAREA:long_name = area of T cells ;
		TAREA:coordinates = TLONG TLAT ;
	float64 UAREA(nlat, nlon) ;
		UAREA:units = cm^2 ;
		UAREA:long_name = area of U cells ;
		UAREA:coordinates = ULONG ULAT ;
	int32 KMT(nlat, nlon) ;
		KMT:long_name = k Index of Deepest Grid Cell on T Grid ;
		KMT:coordinates = TLONG TLAT ;
	int32 REGION_MASK(nlat, nlon) ;
		REGION_MASK:long_name = basin index number (signed integers) ;
		REGION_MASK:coordinates = TLONG TLAT ;
	float64 z_t(z_t) ;
		z_t:units = cm ;
		z_t:long_name = depth from surface to midpoint of layer ;
		z_t:positive = down ;
	float64 dz(z_t) ;
		dz:units = cm ;
		dz:long_name = thickness of layer k ;
	float64 z_w(z_w) ;
		z_w:units = cm ;
		z_w:positive = down ;
		z_w:long_name = depth from surface to top of layer ;
	float64 z_w_bot(z_w_bot) ;
		z_w_bot:units = cm ;
		z_w_bot:positive = down ;
		z_w_bot:long_name = depth from surface to bottom of layer ;

// global attributes:
	:lateral_dims = [2400, 3600] ;
	:vertical_dims = 62 ;
	:vert_grid_file = tx0.1v3_vert_grid ;
	:horiz_grid_fname = inputdata/ocn/pop/tx0.1v3/grid/horiz_grid_200709.ieeer8 ;
	:topography_fname = inputdata/ocn/pop/tx0.1v3/grid/topography_20170718.ieeei4 ;
	:region_mask_fname = inputdata/ocn/pop/tx0.1v3/grid/region_mask_20170718.ieeei4 ;
	:type = tripole ;
	:title = POP_tx0.1v3 grid ;
}

Visualize grid#

Take a quick look at KMT (k Index of Deepest Grid Cell on T Grid), applying a land-mask criterion along the way.

h = ds.KMT.where(ds.KMT > 0).plot()
../_images/e7474a1d94670cd7e1588d077f95fc8fba294aa6367008b3190d83e4f447b27a.png

And the coordinates: TLAT

h = ds.TLAT.where(ds.KMT > 0).plot()
../_images/ead4de60dedec339b49b35b1c421b820e63c9647090b5d2f7fcd723f35bbdcca.png

and TLONG

h = ds.TLONG.where(ds.KMT > 0).plot()
../_images/c6ec0433f25bfc718a2e1233ef3d5e93e3469526f52c08a4bc3f209397f88c61.png

SCRIP format#

It is also possible to get the grid file in SCRIP format which is useful for regridding applications with ESMF.

ds = pop_tools.get_grid('POP_tx0.1v3', scrip=True)
ds.info()
xarray.Dataset {
dimensions:
	grid_rank = 2 ;
	grid_size = 8640000 ;
	grid_corners = 4 ;

variables:
	int32 grid_dims(grid_rank) ;
	float64 grid_center_lat(grid_size) ;
		grid_center_lat:units = degrees ;
	float64 grid_center_lon(grid_size) ;
		grid_center_lon:units = degrees ;
	float64 grid_corner_lat(grid_size, grid_corners) ;
		grid_corner_lat:units = degrees ;
	float64 grid_corner_lon(grid_size, grid_corners) ;
		grid_corner_lon:units = degrees ;
	int64 grid_imask(grid_size) ;
		grid_imask:units = unitless ;

// global attributes:
	:lateral_dims = [2400, 3600] ;
	:vertical_dims = 62 ;
	:vert_grid_file = tx0.1v3_vert_grid ;
	:horiz_grid_fname = inputdata/ocn/pop/tx0.1v3/grid/horiz_grid_200709.ieeer8 ;
	:topography_fname = inputdata/ocn/pop/tx0.1v3/grid/topography_20170718.ieeei4 ;
	:region_mask_fname = inputdata/ocn/pop/tx0.1v3/grid/region_mask_20170718.ieeei4 ;
	:type = tripole ;
	:title = POP_tx0.1v3 grid ;
	:conventions = SCRIP ;
}
%load_ext watermark
%watermark -d -iv -m -g
Compiler    : GCC 13.3.0
OS          : Linux
Release     : 6.17.0-1007-aws
Machine     : x86_64
Processor   : x86_64
CPU cores   : 2
Architecture: 64bit

Git hash: d3177f392237bc6adcac68c1963bdc5fe1a3ccd6

pop_tools: 0.0.post50+dirty
xarray   : 2024.7.0