terra_model
This submodule provides the TerraModel class. This class holds the data contained within a single time slice of a TERRA mantle convection simulation.
FieldDimensionError
Bases: Exception
Exception type raised when trying to set a field when the dimensions do not match the coordinates in the model
Source code in terratools/terra_model.py
180 181 182 183 184 185 186 187 188 189 190 191 |
|
FieldNameError
Bases: Exception
Exception type raised when trying to use an incorrect field name
Source code in terratools/terra_model.py
137 138 139 140 141 142 143 144 |
|
FileFormatError
Bases: Exception
Exception type raised when a netCDF file is not correctly formatted.
Source code in terratools/terra_model.py
226 227 228 229 230 231 232 233 234 235 236 |
|
LayerMethodError
Bases: Exception
Exception type raised when trying to call incompatible TerraModel method for a TerraModelLayer object
Source code in terratools/terra_model.py
215 216 217 218 219 220 221 222 223 |
|
NewFieldNameError
Bases: Exception
Exception type raised when trying to use an incorrect field name
Source code in terratools/terra_model.py
127 128 129 130 131 132 133 134 |
|
NoFieldError
Bases: Exception
Exception type raised when trying to access a field which is not present
Source code in terratools/terra_model.py
159 160 161 162 163 164 165 166 |
|
NoSphError
Bases: Exception
Exception type raised when trying to access spherical harmonics which have not yet been calculated.
Source code in terratools/terra_model.py
169 170 171 172 173 174 175 176 177 |
|
PlumeFieldError
Bases: Exception
Exception type raised when correct fields not available for plume detection
Source code in terratools/terra_model.py
147 148 149 150 151 152 153 154 155 156 |
|
SizeError
Bases: Exception
Exception type raised when input param is wrong shape
Source code in terratools/terra_model.py
205 206 207 208 209 210 211 212 |
|
TerraModel
Class holding a TERRA model at a single point in time.
A TerraModel contains the coordinates of each lateral point, the radii of each layer, and zero or more fields at each of these points.
Fields are either 2D (for scalar fields like temperature) or 3D (for multicomponent arrays like flow velocity) NumPy arrays.
There are two kinds of methods which give you information about the contents of a TerraModel:
-
Methods starting with
get_
return a reference to something held within the model. Hence things returned byget
ters can be modified and the TerraModel instance is also modified. For example,get_field("vp")
returns the array containing the P-wave velocity for the whole model, and you can update any values within it. You should not change the shape or length of any arrays returned fromget_
methods, as this will make the internal state of a TerraModel inconsistent. -
Methods which are simply a noun (like
number_of_compositions
) return a value and this cannot be used to change the model.
Model coordinates
TerraModels have a number of layers, and within each layer there are a number of lateral points, of which there are always the same number. Points on each layer at the same point index always have the same coordinates.
Use TerraModel.get_lateral_points()
to obtain the longitude and
latitude of the lateral points.
TerraModel.get_radii()
returns instead the radii (in km) of
each of the layers in the model.
Model fields
Models fields (as returned by TerraModel.get_field
) are simply
NumPy arrays. The first index is the layer index, and the second
is the point index.
As an example, if for a model m
you obtain the temperature field
with a call temp = m.get_field("t")
, the lateral coordinates
lon, lat = m.get_lateral_points()
and the radii r = m.get_radii()
,
the temperature at lon[ip], lat[ip]
and radius r[ir]
is given
by temp[ir,ip]
.
Nearest neighbours
The nearest lateral point index to an arbitrary geographic location
can be obtained by m.nearest_index(lon, lat)
, whilst the nearest
n
neighbours can be obtained with m.nearest_indices(lon, lat, n)
.
m.nearest_neighbours(lon, lat, n)
also returns the distances to
each near-neighbour.
Source code in terratools/terra_model.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 |
|
Plumes
An inner class of TerraModel, this class hold information pertaining to plumes
which have been detected using the model.detect_plumes
method.
Source code in terratools/terra_model.py
1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 |
|
__init__(kmeans, plm_layers, plm_depths, clust_result, model)
Initialise new plumes inner class
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kmeans |
Array of shape (nps,maxlyr-minlyr+1) where nps is the number of points in radial layer of a TerraModel and minlyr and maxlyr are the min and max layers over which we searched for plumes. Array contains binary information on whether a plume was detected. |
required | |
plm_layers |
Layers of the TerraModel over which we searched for plumes |
required | |
plm_depths |
Depths corresponding to the plm_layers |
required | |
clust_result |
Cluster labels assigned by the spatial clustering |
required | |
model |
TerraModel, needed to access fields in the inner class |
required |
Returns:
Type | Description |
---|---|
none |
Source code in terratools/terra_model.py
1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 |
|
calc_centroids()
Method calculates the centroids of each plume at each layer that the plume has been detected.
Returns:
Type | Description |
---|---|
none |
Source code in terratools/terra_model.py
1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 |
|
plot_kmeans_stack(centroids=0, delta=None, extent=(-180, 180, -90, 90), method='nearest', coastlines=True, show=True)
Create a heatmap of vertically stacked results of k-means analysis
Parameters:
Name | Type | Description | Default |
---|---|---|---|
centroids |
layer for which to plot centroids, eg 0 will plot plot the centroid of the uppermost layer for each plume, None will cause to not plot centorids. |
0
|
|
delta |
Grid spacing of plot in degrees |
None
|
|
extent |
Tuple giving the longitude and latitude extent of plot, in the form (min_lon, max_lon, min_lat, max_lat), all in degrees |
(-180, 180, -90, 90)
|
|
method |
May be one of: "nearest" (plot nearest value to each plot grid point); or "mean" (mean value in each pixel) |
'nearest'
|
|
coastlines |
If |
True
|
|
show |
If |
True
|
Returns:
Type | Description |
---|---|
figure and axis handles |
Source code in terratools/terra_model.py
1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 |
|
plot_plumes_3d(elev=10, azim=70, roll=0, dist=20, cmap='terrain', show=True)
Call to generate 3D scatter plot of points which constitute plumes coloured by plumeID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elev |
camera elevation (degrees) |
10
|
|
azim |
camera azimuth (degrees) |
70
|
|
roll |
camera roll (degrees) |
0
|
|
dist |
camera distance (unitless) |
20
|
|
cmap |
string corresponding to matplotlib colourmap |
'terrain'
|
|
show |
If |
True
|
Source code in terratools/terra_model.py
1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 |
|
radial_field(field)
Method to find the values of a given field at points which have been detected as plumes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
A field which exists in the TerraModel. |
required |
Returns:
Type | Description |
---|---|
none |
Source code in terratools/terra_model.py
1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 |
|
__init__(lon, lat, r, surface_radius=None, fields={}, c_histogram_names=None, c_histogram_values=None, lookup_tables=None, pressure_func=None)
Construct a TerraModel.
The basic TerraModel constructor requires the user to supply a set
of radii r
in km, and a set of lateral point coordinates as
two separate arrays of longitude and latitude (in degrees).
These then define the 2D grid on which the field values are defined.
Fields are passed in as a dict mapping field name onto either a 2D array (for scalar fields like temperature), or a 3D array for multicomponent fields, like flow velocity or composition histograms.
Composition histograms enable one to translate from temperature,
pressure and composition to seismic velocity by assuming the
model contains a mechanical mixture of some number of different
chemical components, and performing Voigt averaging over the
elastic parameters predicted for these compositions, weighted
by their proportion. The field "c_hist"
holds a 3D array
whose last dimension gives the proportion of each component.
At each depth and position, the proportions must sum to unity,
and this is checked in the constructor.
When using a composition histogram, you may pass the
c_histogram_names
argument, giving the name of each component,
and c_histogram_values
, giving the composition value of each.
The ith component name corresponds to the proportion of the ith
slice of the last dimension of the "c_hist"
array.
Seismic lookup tables should be passed to this constructor
when using multicomponent composition histograms as a dict
whose keys are the names in c_histogram_name
and whose values
are instances of terratools.lookup_tables.SeismicLookupTable
.
Alternatively, lookup_tables
may be an instance of
terratools.lookup_tables.MultiTables
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
Position in longitude of lateral points (degrees) |
required | |
lat |
Position in latitude of lateral points (degrees). lon and lat must be the same length |
required | |
r |
Radius of nodes in radial direction. Must increase monotonically. |
required | |
surface_radius |
Radius of surface of the model in km, if not the same as the largest value of |
None
|
|
fields |
dict whose keys are the names of field, and whose values are numpy arrays of dimension (nlayers, npts) for scalar fields, and (nlayers, npts, ncomps) for a field with |
{}
|
|
c_histogram_names |
The names of each composition of the composition histogram, passed as a |
None
|
|
c_histogram_values |
The values of each composition of the composition histogram, passed as a |
None
|
|
lookup_tables |
A dict mapping composition name to the file name of the associated seismic lookup table; or a |
None
|
|
pressure_func |
Function which takes a single argument (the radius in km) and returns pressure in Pa. By default pressure is taken from PREM. The user is responsible for ensuring that |
None
|
Source code in terratools/terra_model.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
|
add_adiabat()
Add a theoretical adiabat to the temperatures in the TerraModel object. The adiabat is linear in the upper mantle and then is fit to a quadratic in the lower mantle.
Returns:
Type | Description |
---|---|
none |
Source code in terratools/terra_model.py
1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 |
|
add_geog_flow()
Add the field u_enu which holds the flow vector which has been rotated from cartesian to geographical.
Returns:
Type | Description |
---|---|
none |
Source code in terratools/terra_model.py
1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 |
|
add_lookup_tables(lookup_tables)
Add set of lookup tables to the model. The tables must have the same keys as the model has composition names.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lookup_tables |
A |
required |
Source code in terratools/terra_model.py
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
|
calc_bulk_composition()
Calculate the bulk composition field from composition histograms. Stored as new scalar field 'c'
Source code in terratools/terra_model.py
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 |
|
calc_spherical_harmonics(field, nside=2 ** 6, lmax=16, savemap=False, use_pixel_weights=False)
Function to calculate spherical harmonic coefficients for given global field. Model is re-gridded to an equal area healpix grid of size nside (see https://healpix.sourceforge.io/ for details) and then expanded to spherical harmonic coefficients up to degree lmax, with pixels being uniformally weighted by 4pi/n_pix (see https://healpy.readthedocs.io/en/latest/index.html for details).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
input field |
required |
nside |
int (power of 2)
|
healpy param, number of sides for healpix grid, power of 2 less than 230 (default 26) |
2 ** 6
|
lmax |
int
|
maximum spherical harmonic degree (default 16) |
16
|
savemap |
bool
|
Default ( |
False
|
Source code in terratools/terra_model.py
1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 |
|
detect_plumes(depth_range=(400, 2600), algorithm='HDBSCAN', n_init='auto', epsilon=150, minsamples=150)
Uses the temperature and velocity fields to detect mantle plumes. Our scheme is a two stage process, first plume-like regions identified using a K-means clustering algorithm, then the resultant points are spatially clustered using a density based clustering algorithm to identify individual plumes. An inner 'plumes' class is created within the TerraModel to store information pertaining to detected plumes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
depth_range |
(min_depth, max_depth) over which to look for plumes |
(400, 2600)
|
|
algorithm |
Spatial clustering algorithm - 'DBSCAN' and 'HDBSCAN' supported |
'HDBSCAN'
|
|
n_init |
Number of times to run k-means with different starting centroids |
'auto'
|
|
epsilon |
Threshold distance parameter for DBSCAN, min_cluster_size for HDBSCAN |
150
|
|
minsamples |
Minimum number of samples in a neighbourhood for DBSCAN and HDBSCAN |
150
|
Returns:
Type | Description |
---|---|
none |
Source code in terratools/terra_model.py
1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 |
|
evaluate(lon, lat, r, field, method='triangle', depth=False)
Evaluate the value of field at radius r km, latitude lat degrees and longitude lon degrees.
Note that if r is below the bottom of the model the value at the lowest layer is returned; and likewise if r is above the top of the model, the value at the highest layer is returned.
There are two evaluation methods:
. "triangle"
: Finds the triangle surrounding the point of
interest and performs interpolation between the values at each vertex of the triangle
. "nearest"
: Just returns the value of the closest point of
the TerraModel
In either case, linear interpolation is performed between the two surrounding layers of the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
Longitude in degrees of point of interest |
required | |
lat |
Latitude in degrees of points of interest |
required | |
r |
Radius in km of point of interest |
required | |
field |
String giving the name of the field of interest |
required | |
method |
String giving the name of the evaluation method; a choice of 'triangle' (default) or 'nearest'. |
'triangle'
|
|
depth |
If True, treat r as a depth rather than a radius |
False
|
Returns:
Type | Description |
---|---|
value of the field at that point |
Source code in terratools/terra_model.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
|
evaluate_from_lookup_tables(lon, lat, r, fields=TABLE_FIELDS, method='triangle', depth=False)
Evaluate the value of a field at radius r
km, longitude
lon
degrees and latitude lat
degrees by using
the composition or set of composition proportions at that point
and a set of seismic lookup tables to convert to seismic
properties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
Longitude in degrees of point of interest |
required | |
lat |
Latitude in degrees of points of interest |
required | |
r |
Radius in km of point of interest |
required | |
fields |
Iterable of strings giving the names of the field of interest, or a single string. If a single string is passed in, then a single value is returned. By default, all fields are returned. |
TABLE_FIELDS
|
|
method |
String giving the name of the evaluation method; a choice of |
'triangle'
|
|
depth |
If |
False
|
Returns:
Type | Description |
---|---|
If a set of fields are passed in, or all are requested (the default), a |
Source code in terratools/terra_model.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 |
|
field_names()
Return the names of the fields present in a TerraModel.
Returns:
Type | Description |
---|---|
list of the names of the fields present. |
Source code in terratools/terra_model.py
520 521 522 523 524 525 526 |
|
get_composition_names()
If a model contains a composition histogram field ('c_hist'), return the names of the compositions; otherwise return None.
Returns:
Type | Description |
---|---|
list of composition names |
Source code in terratools/terra_model.py
898 899 900 901 902 903 904 905 906 907 908 |
|
get_composition_values()
If a model contains a composition histogram field ('c_hist'), return the values of the compositions; otherwise return None.
Returns:
Type | Description |
---|---|
list of composition values |
Source code in terratools/terra_model.py
910 911 912 913 914 915 916 917 918 919 920 |
|
get_field(field)
Return the array containing the values of field in a TerraModel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
Name of the field |
required |
Returns:
Type | Description |
---|---|
the field of interest as a numpy.array |
Source code in terratools/terra_model.py
831 832 833 834 835 836 837 838 839 |
|
get_lateral_points()
Return two numpy.arrays, one each for the longitude and latitude (in degrees) of the lateral points of each depth slice of the fields in a model.
Returns:
Type | Description |
---|---|
(lon, lat) in degrees |
Source code in terratools/terra_model.py
922 923 924 925 926 927 928 929 930 |
|
get_lookup_tables()
Return the terratools.lookup_tables.MultiTables
object which
holds the model's lookup tables if present, and None
otherwise.
Returns:
Type | Description |
---|---|
the lookup tables, or |
Source code in terratools/terra_model.py
932 933 934 935 936 937 938 939 940 941 942 |
|
get_radii()
Return the radii of each layer in the model, in km.
Returns:
Type | Description |
---|---|
radius of each layer in km |
Source code in terratools/terra_model.py
944 945 946 947 948 949 950 |
|
get_spherical_harmonics(field)
Return the spherical harmonic coefficients and power per l (and maps if calculated) or raise NoSphError
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
Name of field |
required |
Returns:
Type | Description |
---|---|
dictionary containing spherical harmonic coefficients and power per l at each layer |
Source code in terratools/terra_model.py
841 842 843 844 845 846 847 848 849 850 851 852 |
|
has_field(field)
Return True if this TerraModel contains a field called field
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
Name of field |
required |
Returns:
Type | Description |
---|---|
True if field is present, and False otherwise |
Source code in terratools/terra_model.py
812 813 814 815 816 817 818 819 |
|
has_lookup_tables()
Return True
if this TerraModel contains thermodynamic lookup
tables used to convert temperature, pressure and composition
into seismic properties.
Returns:
Type | Description |
---|---|
|
Source code in terratools/terra_model.py
821 822 823 824 825 826 827 828 829 |
|
mean_radial_profile(field)
Return the mean of the given field at each radius.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
name of field |
required |
Returns:
Type | Description |
---|---|
1d numpy array of floats.
|
mean values of field at each radius. |
Source code in terratools/terra_model.py
952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 |
|
nearest_index(lon, lat)
Return the index or indices of the lateral point(s) nearest to the one or more points supplied. lon and lat may either both be a scalar or both an array of points; behaviour is undefined if a mix is provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
Longitude of point(s) of interest (degrees) |
required | |
lat |
Latitude of point(s) of interest (degrees) |
required |
Returns:
Type | Description |
---|---|
the index or indices of the nearest lateral point. This is a scalar for scalar input, and an array for array input. |
Source code in terratools/terra_model.py
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 |
|
nearest_indices(lon, lat, n)
Return the indices of the lateral point(s) nearest to the one or more points supplied. lon and lat may either both be a scalar or both an array of points; behaviour is undefined if a mix is provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
Longitude of point(s) of interest (degrees) |
required | |
lat |
Latitude of point(s) of interest (degrees) |
required | |
n |
Number of nearest neighbours to find |
required |
Returns:
Type | Description |
---|---|
the indices of the nearest n lateral points. This is vector for scalar input, and a vector of vectors for array input. |
Source code in terratools/terra_model.py
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 |
|
nearest_layer(radius, depth=False)
Find the layer nearest to the given radius.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
radius |
Radius of interest in km. |
required | |
depth |
If True, treat input radius as a depth instead, and return index and depth rather than index and radius. |
False
|
Returns:
Type | Description |
---|---|
layer index and radius of layer in km if depth is False (the default); otherwise return layer index and depth in km |
Source code in terratools/terra_model.py
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 |
|
nearest_neighbors(lon, lat, n)
Return the indices of the lateral point(s) nearest to the one or more points supplied, and the distances from the test point to each point. lon and lat may either both be a scalar or both an array of points; behaviour is undefined if a mix is provided.
Distances are in radians about the centre of the sphere; to convert to great circle distances, multiply by the radius of interest.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
Longitude of point(s) of interest (degrees) |
required | |
lat |
Latitude of point(s) of interest (degrees) |
required | |
n |
Number of nearest neighbours to find |
required |
Returns:
Type | Description |
---|---|
(indices, distances), where the first item contains the indices of the nearest n lateral points and the second item gives the distances in radians about the centre on the sphere on which the points all lie. These are vectors for scalar input, and a vector of vectors for array input. |
Source code in terratools/terra_model.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 |
|
new_field(name, ncomps=None, label=None)
Create a new, empty field with key name
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Name of new field. |
required | |
ncomps |
Number of components for a multicomponent field. |
None
|
Returns:
Type | Description |
---|---|
the new field |
Source code in terratools/terra_model.py
749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
|
number_of_compositions()
If a model contains a composition histogram field ('c_hist'), return the number of compositions; otherwise return None.
Returns:
Type | Description |
---|---|
number of compositions or None |
Source code in terratools/terra_model.py
886 887 888 889 890 891 892 893 894 895 896 |
|
plot_hp_map(field, index=None, radius=None, depth=False, nside=2 ** 6, title=None, delta=None, extent=(-180, 180, -90, 90), method='nearest', show=True, **subplots_kwargs)
Create heatmap of a field recreated from the spherical harmonic coefficients
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
name of field as created using |
required |
index |
int
|
index of layer to plot |
None
|
radius |
float
|
radius to plot (nearest model radius is shown) |
None
|
nside |
int (power of 2)
|
healpy param, number of sides for healpix grid, power of 2 less than 230 (default 26) |
2 ** 6
|
title |
str
|
name of field to be included in title |
None
|
delta |
float
|
Grid spacing of plot in degrees |
None
|
extent |
tuple of length 4
|
Tuple giving the longitude and latitude extent of plot, in the form (min_lon, max_lon, min_lat, max_lat), all in degrees |
(-180, 180, -90, 90)
|
method |
str
|
May be one of: "nearest" (plot nearest value to each plot grid point); or "mean" (mean value in each pixel) |
'nearest'
|
show |
bool
|
If True (the default), show the plot |
True
|
**subplots_kwargs |
Extra keyword arguments passed to |
{}
|
Returns:
Type | Description |
---|---|
figure and axis handles |
Source code in terratools/terra_model.py
1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 |
|
plot_layer(field, radius=None, index=None, depth=False, delta=None, extent=(-180, 180, -90, 90), method='nearest', coastlines=True, show=True)
Create a heatmap of the values of a particular field at the model
layer nearest to radius
km.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
Name of field of interest |
required | |
radius |
Radius in km at which to show map. The nearest model layer to this radius is shown. |
None
|
|
index |
Rather than using a certain radius, plot the field exactly at a layer index |
None
|
|
depth |
If True, interpret the radius as a depth instead |
False
|
|
delta |
Grid spacing of plot in degrees |
None
|
|
extent |
Tuple giving the longitude and latitude extent of plot, in the form (min_lon, max_lon, min_lat, max_lat), all in degrees |
(-180, 180, -90, 90)
|
|
method |
May be one of: "nearest" (plot nearest value to each plot grid point); or "mean" (mean value in each pixel) |
'nearest'
|
|
coastlines |
If |
True
|
|
show |
If |
True
|
Returns:
Type | Description |
---|---|
figure and axis handles |
Source code in terratools/terra_model.py
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 |
|
plot_section(field, lon, lat, azimuth, distance, minradius=None, maxradius=None, delta_distance=1, delta_radius=50, method='nearest', levels=25, cmap=None, show=True)
Create a plot of a cross-section through a model for one of the fields in the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
Name of field to plot |
required |
lon |
float
|
Longitude of starting point of section in degrees |
required |
lat |
float
|
Latitude of starting point of section in degrees |
required |
azimuth |
float
|
Azimuth of cross section at starting point in degrees |
required |
distance |
float
|
Distance of cross section, given as the angle subtended at the Earth's centre between the starting and end points of the section, in degrees. |
required |
minradius |
float
|
Minimum radius to plot in km. If this is smaller than the minimum radius in the model, the model's value is used. |
None
|
maxradius |
float
|
Maximum radius to plot in km. If this is larger than the maximum radius in the model, the model's value is used. |
None
|
method |
str
|
May be one of "nearest" (default) or "triangle", controlling how points are calculated at each plotting grid point. "nearest" simply finds the nearest model point to the required grid points; "triangle" perform triangular interpolation around the grid point. |
'nearest'
|
delta_distance |
float
|
Grid spacing in lateral distance, expressed in units of degrees of angle subtended about the centre of the Earth. Default 1°. |
1
|
delta_radius |
float
|
Grid spacing in radial directions in km. Default 50 km. |
50
|
levels |
int | set of floats
|
Number of levels or set of levels to plot |
25
|
cmap |
str
|
Colour map to be used (default "turbo") |
None
|
show |
bool
|
If |
True
|
Returns:
Type | Description |
---|---|
figure and axis handles |
Source code in terratools/terra_model.py
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 |
|
plot_spectral_heterogeneity(field, title=None, saveplot=False, savepath=None, lmin=1, lmax=None, lyrmin=1, lyrmax=-1, show=True, **subplots_kwargs)
Plot spectral heterogenity maps of the given field, that is the power spectrum over depth.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
name of field to plot as created using model.calc_spherical_harmonics() |
required |
title |
str
|
title of plot |
None
|
saveplot |
bool
|
flag to save an image of the plot to file |
False
|
savepath |
str
|
path under which to save plot to |
None
|
lmin |
int
|
minimum spherical harmonic degree to plot (default=1) |
1
|
lmax |
int
|
maximum spherical harmonic degree to plot (default to plot all) |
None
|
lyrmin |
int
|
min layer to plot (default omits boundary) |
1
|
lyrmax |
int
|
max layer to plot (default omits boundary) |
-1
|
show |
bool
|
if True (default) show the plot |
True
|
**subplots_kwargs |
Extra keyword arguments passed to |
{}
|
Returns:
Type | Description |
---|---|
figure and axis handles |
Source code in terratools/terra_model.py
1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 |
|
pressure_at_radius(r)
Evaluate the pressure in the model at a radius of r
km.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r |
Radius in km |
required |
Returns:
Type | Description |
---|---|
Pressure in GPa |
Source code in terratools/terra_model.py
1125 1126 1127 1128 1129 1130 1131 1132 |
|
radial_profile(lon, lat, field, method='nearest')
Return the radial profile of the given field at a given longitude and latitude point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
float
|
Longitude at which to get radial profile. |
required |
lat |
float
|
Latitude at which to get radial profile. |
required |
field |
str
|
Name of field. |
required |
method |
str
|
Method by which the lateral points are evaluated. if |
'nearest'
|
Returns:
Type | Description |
---|---|
1d numpy array of floats.
|
values of field for each radius at a given longitude and latitude. The radii of each point can be obtained using |
Source code in terratools/terra_model.py
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 |
|
set_field(field, values)
Create a new field within a TerraModel from a predefined array, replacing any existing field data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
Name of field |
required |
values |
numpy.array
|
numpy.array containing the field. For scalars it should have dimensions corresponding to (nlayers, npts), where nlayers is the number of layers and npts is the number of lateral points. For multi-component fields, it should have dimensions (nlayers, npts, ncomps), where ncomps is the number of components |
required |
Source code in terratools/terra_model.py
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 |
|
to_depth(radius)
Convert a radius in km to a depth in km.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
radius |
Radius in km |
required |
Returns:
Type | Description |
---|---|
Depth in km |
Source code in terratools/terra_model.py
1134 1135 1136 1137 1138 1139 1140 1141 |
|
to_radius(depth)
Convert a radius in km to a depth in km.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
depth |
Depth in km |
required |
Returns:
Type | Description |
---|---|
Radius in km |
Source code in terratools/terra_model.py
1143 1144 1145 1146 1147 1148 1149 1150 |
|
write_pickle(filename)
Save the terra model as a python pickle format with the given filename.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
filename to save terramodel to. |
required |
Returns:
Type | Description |
---|---|
nothing |
Source code in terratools/terra_model.py
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 |
|
TerraModelLayer
Bases: TerraModel
A subclass of the TerraModel superclass, TerraModelLayer is for storing 2D layer information which is written out of a TERRA simulation. Typically this might be some boundary information, eg CMB heat flux or radial surface radial stresses, but could be from any radial layer of the simulation in principle.
Methods of the TerraModel class which are not compatible with TerraModelLayer are overwritten and will raise a LayerMethodError exception
Source code in terratools/terra_model.py
1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 |
|
VersionError
Bases: Exception
Exception type raised when old version of unversioned netCDF files are passed in.
Source code in terratools/terra_model.py
194 195 196 197 198 199 200 201 202 |
|
load_model_from_pickle(filename)
Load a terra model saved using the save() function above.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
filename to load terramodel from. |
required |
Returns:
Type | Description |
---|---|
TerraModel object
|
loaded terra model |
Source code in terratools/terra_model.py
2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 |
|
read_netcdf(files, fields=None, surface_radius=6370.0, test_lateral_points=False, cat=False)
Read a TerraModel from a set of NetCDF files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files |
List or iterable of file names of TERRA NetCDF model files |
required | |
fields |
Iterable of field names to be read in. By default all fields are read in. |
None
|
|
surface_radius |
Radius of the surface of the model in km (default 6370 km) |
6370.0
|
Returns:
Type | Description |
---|---|
a new |
Source code in terratools/terra_model.py
1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 |
|