bgc_data_processing.tracers
¶
Plotting objects.
BasePlot(storer, constraints)
¶
Bases: ABC
Base class to plot data from a storer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Storer to plot data of. |
required |
constraints |
Constraints
|
|
required |
Initiate Base class to plot data from a storer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Storer to plot data of. |
required |
constraints |
Constraints
|
|
required |
Source code in src/bgc_data_processing/tracers.py
42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
show(title=None, suptitle=None, **kwargs)
abstractmethod
¶
Plot method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle to change from default., by default None |
None
|
*kwargs |
Additional parameters to pass to self._build_to_new_figure. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
save(save_path, title=None, suptitle=None, **kwargs)
abstractmethod
¶
Figure saving method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
save_path |
str
|
Path to save the output image. |
required |
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle to change from default., by default None |
None
|
*kwargs |
Additional parameters to pass to self._build_to_new_figure. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
plot_to_axes(ax, *args, **kwargs)
abstractmethod
¶
Plot data to the given axes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
Axes | GeoAxes
|
Axes to plot the data on. |
required |
*args |
Additional parameters for the axes plotting method. |
()
|
|
*kwargs |
Additional parameters for the axes plotting method. |
{}
|
Returns:
Type | Description |
---|---|
Axes | GeoAxes
|
Axes were the data is plotted on. |
Source code in src/bgc_data_processing/tracers.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
DensityPlotter(storer, constraints=None)
¶
Bases: BasePlot
Base class for tracing on earthmaps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Data Storer containing data to plot. |
required |
constraints |
Constraints | None
|
|
None
|
Instanciate base class for tracing on earthmaps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Data Storer containing data to plot. |
required |
constraints |
Constraints | None
|
|
None
|
Source code in src/bgc_data_processing/tracers.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
__default_lat_bin: int | float = 1
class-attribute
instance-attribute
¶
__default_lon_bin: int | float = 1
class-attribute
instance-attribute
¶
__default_depth_density: bool = True
class-attribute
instance-attribute
¶
set_bins_size(bins_size)
¶
Set the bin sizes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bins_size |
int | float | Iterable[int | float]
|
Bins size, if tuple, first for latitude, second for longitude. If float or int, size is applied for both latitude and longitude. Unit is supposed to be degree. |
required |
Source code in src/bgc_data_processing/tracers.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
|
set_density_type(consider_depth)
¶
Set the self._depth_density value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
consider_depth |
bool
|
Whether to consider all value in the water for density mapping. |
required |
Source code in src/bgc_data_processing/tracers.py
362 363 364 365 366 367 368 369 370 |
|
set_map_boundaries(latitude_min=np.nan, latitude_max=np.nan, longitude_min=np.nan, longitude_max=np.nan)
¶
Define the boundaries of the map.
(different from the boundaries of the plotted data).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
latitude_min |
int | float
|
Minimum latitude, by default np.nan |
nan
|
latitude_max |
int | float
|
Maximal latitude, by default np.nan |
nan
|
longitude_min |
int | float
|
Mnimal longitude, by default np.nan |
nan
|
longitude_max |
int | float
|
Maximal longitude, by default np.nan |
nan
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
save(save_path, variable_name, title=None, suptitle=None, **kwargs)
¶
Plot the colormesh for the given variable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
save_path |
str
|
Path to save the figure at. |
required |
variable_name |
str
|
Name of the variable to plot. |
required |
title |
str | None
|
Title for the figure, if set to None, automatically created. , by default None. |
None
|
suptitle |
str | None
|
Suptitle for the figure, if set to None, automatically created. , by default None. |
None
|
**kwargs |
Additional arguments to pass to plt.pcolor. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
show(variable_name, title=None, suptitle=None, **kwargs)
¶
Plot the colormesh for the given variable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
title |
str | None
|
Title for the figure, if set to None, automatically created. , by default None. |
None
|
suptitle |
str | None
|
Suptitle for the figure, if set to None, automatically created. , by default None. |
None
|
**kwargs |
Additional arguments to pass to plt.pcolor. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
plot_to_axes(variable_name, ax, **kwargs)
¶
Build the plot to given axes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
ax |
GeoAxes
|
GeoAxes (from cartopy) to plot the data to. |
required |
**kwargs |
Additional arguments to pass to plt.pcolormesh. |
{}
|
Returns:
Type | Description |
---|---|
tuple[GeoAxes, Collection]
|
Axes, Colorbar. |
Source code in src/bgc_data_processing/tracers.py
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 |
|
get_df(variable_name)
¶
Return the density of the given variable on the bins.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to bin. |
required |
Returns:
Type | Description |
---|---|
Dataframe
|
Three columns dataframe : longitude, latitude and variable density. The column names are the same as in the original DataFrame. |
Source code in src/bgc_data_processing/tracers.py
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 |
|
EvolutionProfile(storer, constraints=None)
¶
Bases: BasePlot
Class to plot the evolution of data on a given area.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Storer to map data of. |
required |
constraints |
Constraints | None
|
Constraint slicer. |
None
|
Class to plot the evolution of data on a given area.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Storer to map data of. |
required |
constraints |
Constraints | None
|
|
None
|
Source code in src/bgc_data_processing/tracers.py
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 |
|
__default_interval: str = 'day'
class-attribute
instance-attribute
¶
__default_interval_length: int = 10
class-attribute
instance-attribute
¶
__default_depth_interval: int = 100
class-attribute
instance-attribute
¶
__default_depth_max: int = 0
class-attribute
instance-attribute
¶
reset_intervals()
¶
Reset interval parameters to the default ones.
Source code in src/bgc_data_processing/tracers.py
736 737 738 739 740 |
|
reset_parameters()
¶
Reset all boundaries and intervals to default values.
Source code in src/bgc_data_processing/tracers.py
742 743 744 |
|
set_depth_interval(depth_interval=np.nan)
¶
Set the depth interval value.
This represents the vertical resolution of the final plot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
depth_interval |
int | float | list[int | float]
|
Depth interval values, if numeric, interval resolution, if instance of list, list of depth bins to use., by default np.nan |
nan
|
Source code in src/bgc_data_processing/tracers.py
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
|
set_date_intervals(interval, interval_length=None)
¶
Set the date interval parameters.
This represent the horizontal resolution of the final plot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interval |
str
|
Interval resolution, can be "day", "week", "month", "year" or "custom". |
required |
interval_length |
int
|
Only useful if the resolution interval is "custom". Represents the interval length, in days., by default None |
None
|
Source code in src/bgc_data_processing/tracers.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 |
|
show(variable_name, title=None, suptitle=None, **kwargs)
¶
Plot the figure of data density evolution in a givemn area.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle to change from default., by default None |
None
|
**kwargs |
Additional arguments to pass to plt.pcolor. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
save(save_path, variable_name, title=None, suptitle=None, **kwargs)
¶
Save the figure of data density evolution in a givemn area.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
save_path |
str
|
Path to save the output image. |
required |
variable_name |
str
|
Name of the variable to plot. |
required |
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle to change from default., by default None |
None
|
**kwargs |
Additional arguments to pass to plt.pcolor. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
plot_to_axes(variable_name, ax, **kwargs)
¶
Plot the data on a given axes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot the data of. |
required |
ax |
Axes
|
Axes to plot the data on. |
required |
**kwargs |
Additional arguments to pass to plt.pcolormesh. |
{}
|
Returns:
Type | Description |
---|---|
tuple[Axes, Collection]
|
Axes, colorbar |
Source code in src/bgc_data_processing/tracers.py
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 |
|
TemperatureSalinityDiagram(storer, constraints, salinity_field, temperature_field, ptemperature_field)
¶
Bases: BasePlot
Class to plot a Temperature-Salinity Diagram.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Storer to map data of. |
required |
constraints |
Constraints
|
Constraint slicer. |
required |
temperature_field |
str
|
Name of the temperature field in storer (column name). |
required |
salinity_field |
str
|
Name of the salinity field in storer (column name). |
required |
Source code in src/bgc_data_processing/tracers.py
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 |
|
salinity_field = salinity_field
instance-attribute
¶
temperature_field = temperature_field
instance-attribute
¶
ptemperature_field = ptemperature_field
instance-attribute
¶
show(title=None, suptitle=None, **kwargs)
¶
Plot the Temperature-Salinity diagram.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle., by default None |
None
|
**kwargs |
Additional arguments to pass to plt.pcolor. |
{}
|
Source code in src/bgc_data_processing/tracers.py
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 |
|
save(save_path, title=None, suptitle=None, **kwargs)
¶
Save the figure of Temperature-Salinity Diagram.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
save_path |
str
|
Path to save the output image. |
required |
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle to change from default., by default None |
None
|
**kwargs |
Additional arguments to pass to plt.scatter. |
{}
|
Source code in src/bgc_data_processing/tracers.py
1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 |
|
plot_to_axes(ax, **kwargs)
¶
Plot the data on a given axes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
Axes
|
Axes to plot the data on. |
required |
**kwargs |
Additional arguments to pass to plt.scatter. |
{}
|
Returns:
Type | Description |
---|---|
tuple[Axes, Collection]
|
Axes, colorbar |
Source code in src/bgc_data_processing/tracers.py
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 |
|
VariableBoxPlot(storer, constraints)
¶
Bases: BasePlot
Class to draw box plots for a given variable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Storer to map the data of. |
required |
constraints |
Constraints
|
Constraints slicer. |
required |
Source code in src/bgc_data_processing/tracers.py
1336 1337 |
|
period_mapping: dict[str, str] = {'year': '%Y', 'month': '%Y-%m', 'week': '%Y-%W', 'day': '%Y-%m-%d'}
class-attribute
¶
show(variable_name, period, title=None, suptitle=None, **kwargs)
¶
Plot method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
period |
str
|
Period on which to plot each boxplot. |
required |
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle to change from default., by default None |
None
|
*kwargs |
Additional parameters to pass to plt.boxplot. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
save(variable_name, period, save_path, title=None, suptitle=None, **kwargs)
¶
Figure saving method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
period |
str
|
Period on which to plot each boxplot. |
required |
save_path |
str
|
Path to save the ouput image. |
required |
title |
str | None
|
Specify a title to change from default., by default None |
None
|
suptitle |
str | None
|
Add a suptitle to the figure., by default None |
None
|
**kwargs |
Addictional parameters to pass to plt.boxplot. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
plot_to_axes(variable_name, period, ax, **kwargs)
¶
Plot the data to the given axes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
period |
str
|
Period on which to plot each boxplot. |
required |
ax |
Axes
|
Axes to plot the data on. |
required |
**kwargs |
Additional parameters to pass to plt.boxplot. |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
Axes where the data is plotted on. |
Source code in src/bgc_data_processing/tracers.py
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 |
|
WaterMassVariableComparison(storer, constraints, pressure_var_name, ptemperature_var_name, salinity_var_name, sigma_t_var_name)
¶
Bases: BasePlot
Class to draw a pressure vs variable comparison of water masses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Storer to map the data of. |
required |
constraints |
Constraints
|
Constraints slicer. |
required |
pressure_var_name |
str
|
Name of the pressure variable. |
required |
ptemperature_var_name |
str
|
Potential temperature variable name. |
required |
salinity_var_name |
str
|
Salinity variable name. |
required |
sigma_t_var_name |
str
|
Sigma-t variable name. |
required |
Source code in src/bgc_data_processing/tracers.py
1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 |
|
pressure_var = self._variables.get(pressure_var_name)
instance-attribute
¶
ptemp_var = self._variables.get(ptemperature_var_name)
instance-attribute
¶
salty_var = self._variables.get(salinity_var_name)
instance-attribute
¶
sigma_t_var = self._variables.get(sigma_t_var_name)
instance-attribute
¶
show(variable_name, wmasses, title=None, suptitle=None, **kwargs)
¶
Plot method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
wmasses |
list[WaterMass]
|
List all water masses. |
required |
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle to change from default., by default None |
None
|
*kwargs |
Additional parameters to pass to plt.scatter. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
save(variable_name, wmasses, save_path, title=None, suptitle=None, **kwargs)
¶
Figure saving method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
wmasses |
list[WaterMass]
|
List all water masses. |
required |
save_path |
str
|
Path to save the ouput image. |
required |
title |
str | None
|
Specify a title to change from default., by default None |
None
|
suptitle |
str | None
|
Add a suptitle to the figure., by default None |
None
|
**kwargs |
Addictional parameters to pass to plt.scatter. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
plot_to_axes(variable_name, wmasses, ax, **kwargs)
¶
Plot the data to the given axes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
wmasses |
list[WaterMass]
|
List all water masses. |
required |
ax |
Axes
|
Axes to plot the data on. |
required |
**kwargs |
Additional parameters to pass to plt.scatter. |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
Axes where the data is plotted on. |
Source code in src/bgc_data_processing/tracers.py
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 |
|
VariableHistogram(storer, constraints)
¶
Bases: BasePlot
Class to draw histogram for a given variable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storer |
Storer
|
Storer to map the data of. |
required |
constraints |
Constraints
|
Constraints slicer. |
required |
Source code in src/bgc_data_processing/tracers.py
1801 1802 |
|
bin_number: int = 100
class-attribute
instance-attribute
¶
show(variable_name, title=None, suptitle=None, **kwargs)
¶
Plot method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
title |
str
|
Specify a title to change from default., by default None |
None
|
suptitle |
str
|
Specify a suptitle to change from default., by default None |
None
|
*kwargs |
Additional parameters to pass to plt.hist. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
save(variable_name, save_path, title=None, suptitle=None, **kwargs)
¶
Figure saving method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
save_path |
str
|
Path to save the ouput image. |
required |
title |
str | None
|
Specify a title to change from default., by default None |
None
|
suptitle |
str | None
|
Add a suptitle to the figure., by default None |
None
|
**kwargs |
Addictional parameters to pass to plt.hist. |
{}
|
Source code in src/bgc_data_processing/tracers.py
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 |
|
plot_to_axes(variable_name, ax, **kwargs)
¶
Plot the data to the given axes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variable_name |
str
|
Name of the variable to plot. |
required |
ax |
Axes
|
Axes to plot the data on. |
required |
**kwargs |
Additional parameters to pass to plt.hist. |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
Axes where the data is plotted on. |
Source code in src/bgc_data_processing/tracers.py
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 |
|