Measurements Toolkits API¶
Toolkits for managing GIS data, meteorological observations, and experimental measurements.
GIS - Vector¶
BuildingsToolkit¶
hera.measurements.GIS.vector.buildings.toolkit.BuildingsToolkit
¶
Bases: VectorToolkit
Toolkit to manage the buildings. Reading the shapefile with geoDataFrame will result in dataframe with the following columns: - Geometry: the polygon of the building. - Building height column : the column name is in BuildingHeightColumn. Default value=BLDG_HT. - Land height : the columns name is in LandHeightColumn. Default value=HT_LAND.
Source code in hera/measurements/GIS/vector/buildings/toolkit.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 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 | |
__init__(projectName, filesDirectory=None, connectionName=None)
¶
Initialize the buildings toolkit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
str
|
Name of the project. |
required |
filesDirectory
|
str or None
|
Path to the files directory. |
None
|
connectionName
|
str or None
|
Database connection name. |
None
|
Source code in hera/measurements/GIS/vector/buildings/toolkit.py
getBuildingHeightFromRasterTopographyToolkit(buildingData, topographyDataSource=None)
¶
Get the topography height of each building (at its center) in the building data using the topography toolkit. Return data frame wtih 'evaluation' as a column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buildingData
|
geopandas.geoDataFrame.
|
The building. |
required |
topographyDataSource
|
string,default=None.
|
The name of the datasource in the topography toolkit. If None, use the default datasource there. |
None
|
Returns:
| Type | Description |
|---|---|
geopandas.DataFrame
|
|
Source code in hera/measurements/GIS/vector/buildings/toolkit.py
buildingsGeopandasToSTLRasterTopography(buildingData, buildingHeightColumn, buildingElevationColumn, outputFileName, flatTerrain=False, referenceTopography=0, nonFlatTopographyShift=10)
¶
Converts a building data (in geopandas format) to STL using the FreeCAD module. Using the raster topography to estimate the height of each building. This is a low level procedure. It can be used, but the easier way to use the toolkit is to generate the buildings from an area using the regionToSTL procedure. We must save the file to the disk, as it is the current implementation of FreeCAD.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buildingData
|
DataFrame
|
The buildings data. |
required |
buildingHeightColumn
|
string
|
The name of the column that holds the height of the buildings in [m]. |
required |
buildingElevationColumn
|
The name of the column that holds the elevation of the building. |
required | |
outputFileName
|
string
|
The absolute path of the output STL. |
required |
flatTerrain
|
bool
|
If true, use a flat terrain. |
False
|
nonFlatTopographyShift
|
float
|
Shift the house with respect to its height in the topography. |
10
|
referenceTopography
|
float [default 0]
|
If flatTerrain, use this as the reference height for the buildings. |
0
|
Source code in hera/measurements/GIS/vector/buildings/toolkit.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
getBuildingsFromRectangle(minx, miny, maxx, maxy, dataSourceName=None, inputCRS=WGS84, withElevation=False)
¶
Return the buildings geopandas for the rectangle region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minx
|
Minimum value of x-axis. |
required | |
miny
|
Minimum value of y-axis. |
required | |
maxx
|
Maximum value of x-axis. |
required | |
may
|
Maximum value of y-axis. |
required | |
dataSourceName
|
The datasource name. If none, will use the default datasource. |
None
|
|
withElevation
|
bool,default=False.
|
If True, use the topography (raster) toolkit to get the heights. |
False
|
Returns:
| Type | Description |
|---|---|
geopandas.DataFrame
|
|
Source code in hera/measurements/GIS/vector/buildings/toolkit.py
get_buildings_height(gdf)
staticmethod
¶
Extract building names, geometries(coordination), and height information from a GeoDataFrame. if there is no height available - it will calculate the number of levels in the building * 3/ else: none
Parameters: gdf (GeoDataFrame): A GeoPandas DataFrame containing building geometries and associated properties.
Returns: geopandas.DataFrame
Source code in hera/measurements/GIS/vector/buildings/toolkit.py
filter_buildings_in_area(buildings_data, min_longitude, min_latitude, max_longitude, max_latitude)
staticmethod
¶
Filter building features by a specified geographic area using a bounding box.
Parameters:
buildings_data : dict A GeoJSON-like dictionary containing building features to filter.
min_longitude : float Minimum longitude defining the bounding box.
min_latitude : float Minimum latitude defining the bounding box.
max_longitude : float Maximum longitude defining the bounding box.
max_latitude : float Maximum latitude defining the bounding box.
Returns:
gpd.GeoDataFrame A GeoDataFrame containing buildings that are located within the specified area.
Source code in hera/measurements/GIS/vector/buildings/toolkit.py
TopographyToolkit (Vector)¶
hera.measurements.GIS.vector.topography.TopographyToolkit
¶
Bases: VectorToolkit
Toolkit for managing and analyzing vector topography data.
Source code in hera/measurements/GIS/vector/topography.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
stlFactory
property
¶
stlFactory : stlFactory The STL factory instance used for vector-to-STL conversions.
__init__(projectName, filesDirectory='', connectionName=None)
¶
Initialize the topography toolkit with project settings and analysis layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
str
|
Name of the project. |
required |
filesDirectory
|
str
|
Path to the files directory. |
''
|
connectionName
|
str or None
|
Database connection name. |
None
|
Source code in hera/measurements/GIS/vector/topography.py
cutRegionFromSource(shapeDataOrName, datasourceName, isBounds=False, crs=None)
¶
Cuts a the shape from the requested datasource
It overrides the parent procedure because we need to perform intersection operation on the results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shapeDataOrName
|
The shape data to use. |
required | |
datasourceName
|
str
|
The name of the satasource to cur from. |
required |
isBounds
|
bool
|
If true, use the bounding box fo the polygon. |
False
|
crs
|
int
|
The EPSG of the coordinate system of the shape (if it is a shape and not in the dtasource ative coordinates). |
None
|
Source code in hera/measurements/GIS/vector/topography.py
geoPandasToSTL(gpandas, dxdy=50, solidName='Topography')
¶
Transforsm the gpandas to STL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gpandas
|
|
required | |
dxdy
|
|
50
|
|
solidName
|
|
'Topography'
|
Source code in hera/measurements/GIS/vector/topography.py
regionToSTL(shapeDataOrName, dxdy, datasourceName, crs=None)
¶
Converts a region in a vector height map (contours) to STL at requested resolution
We always use the bounding box of the input shape .
Parameters:
shapeDataOrName: str or polygon
The shape that we will use.
dxdy: float.
the dimension of each cell in the mesh in meters
dataSourceName: str
The datasource to use.
crs : int [optional]
Used if the CRS of the shapeData is different than the CRS of the datasource.
Returns:
| Type | Description |
|---|---|
str
|
The STL string. |
Source code in hera/measurements/GIS/vector/topography.py
toDEM(regionNameOrData, dxdy=50, **filters)
¶
Creates a Data Elevation Model (DEM) format string of topography.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regionNameOrData
|
The name of the regions, geoJSON string or geodataframe. |
required | |
dxdy
|
The resolution of the conversion . |
50
|
Returns:
| Type | Description |
|---|---|
The DEM string format.
|
|
Source code in hera/measurements/GIS/vector/topography.py
DemographyToolkit¶
hera.measurements.GIS.vector.demography.DemographyToolkit
¶
Bases: VectorToolkit
A toolkit to manage demography data
Source code in hera/measurements/GIS/vector/demography.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
buildings
property
¶
BuildingsToolkit : The buildings toolkit instance.
shapes
property
¶
ShapesToolKit : The shapes toolkit instance.
analysis
property
¶
analysis : The demography analysis layer.
presentation
property
¶
presentation : The demography presentation layer.
populationTypes
property
¶
dict : Mapping of population group names to column names.
FilesDirectory
property
¶
str : Path to the files directory.
__init__(projectName, filesDirectory=None, connectionName=None)
¶
Initializes the demography tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
The project name |
required | |
SourceOrData
|
None: Try to load the default data source. If does not exist, set data to None. str: The name of the source in the DB that will be used as a data. geoDataFrame: Use this as the demography data. See documentation of the structure of the demographic dataframe. |
required | |
dataSourceVersion
|
tuple of integers
|
If specified load this version of the data. |
required |
Source code in hera/measurements/GIS/vector/demography.py
setDefaultDirectory(fileDirectory, create=True)
¶
Set the default directory for the project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fileDirectory
|
|
required | |
create
|
If false and directory does not exist, raise a NotADirectoryError exception. |
True
|
Returns:
| Type | Description |
|---|---|
str, the path.
|
|
Source code in hera/measurements/GIS/vector/demography.py
projectPolygonOnPopulation(shapelyPolygon, dataSourceOrData, populationTypes='All', dataSourceVersion=None)
¶
Deprecated. Use analysis.calculatePopulationInPolygon instead.
Source code in hera/measurements/GIS/vector/demography.py
loadData(regionaName, dataOrFileName, version=(0, 0, 1), metadata=dict(), overwrite=False)
¶
Loading an demographic data to the DB
Currently only an existing shp files/geojson files and replaces
TODO:
- Should be extended in the future to get a string and save it.
- Extend to different save modes (i.e just save a file or warn if already exists).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regionaName
|
|
required | |
dataOrFileName
|
|
required | |
version
|
|
(0, 0, 1)
|
|
metadata
|
|
dict()
|
Source code in hera/measurements/GIS/vector/demography.py
DemographyToolkit — Presentation¶
hera.measurements.GIS.vector.demography.presentation
¶
Presentation layer for the Demography toolkit.
Provides methods for visualizing population density and distribution on geographic maps.
Source code in hera/measurements/GIS/vector/demography.py
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 | |
datalayer
property
¶
DemographyToolkit : Reference to the parent toolkit.
__init__(dataLayer)
¶
Initialize the presentation layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataLayer
|
DemographyToolkit
|
The parent demography toolkit instance. |
required |
plotPopulationDensity(data, populationType='total_pop', density_units=None, ax=None, figsize=(12, 10), cmap='YlOrRd', vmin=None, vmax=None, alpha=1.0, edgecolor='0.5', linewidth=0.3, colorbar=True, colorbar_label=None, title=None, xlim=None, ylim=None, inputCRS=None, outputCRS=ITM)
¶
Plot population density as a choropleth map.
Computes density as population / area for each polygon and plots a colored map.
Example
from hera import toolkitHome demo = toolkitHome.getToolkit(toolkitHome.GIS_DEMOGRAPHY, projectName="MY_PROJECT") census = demo.getDataSourceData("census_2020") demo.presentation.plotPopulationDensity(census, density_units=ureg.km**2)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
GeoDataFrame
|
The demographic data with geometry and population columns. |
required |
populationType
|
str
|
Column name for the population count (default: |
'total_pop'
|
ax
|
Axes
|
Axes to plot on. If None, creates a new figure. |
None
|
figsize
|
tuple of float
|
Figure size (width, height) in inches. Default: (12, 10). |
(12, 10)
|
cmap
|
str or Colormap
|
Colormap name or instance. Default: |
'YlOrRd'
|
vmin
|
float
|
Minimum value for the color scale. If None, auto-detected. |
None
|
vmax
|
float
|
Maximum value for the color scale. If None, auto-detected. |
None
|
alpha
|
float
|
Transparency of the polygons (0=transparent, 1=opaque). Default: 1.0. |
1.0
|
edgecolor
|
str
|
Color of polygon edges. Default: |
'0.5'
|
linewidth
|
float
|
Width of polygon edges. Default: 0.3. |
0.3
|
colorbar
|
bool
|
Whether to show a colorbar. Default: True. |
True
|
density_units
|
Unit
|
The area unit for density calculation. The CRS determines the
native area unit (e.g., m² for ITM). This parameter sets the
denominator unit for the density display. Default: |
None
|
colorbar_label
|
str
|
Label for the colorbar. If None, auto-generated from |
None
|
title
|
str
|
Plot title. |
None
|
xlim
|
tuple of float
|
(xmin, xmax) limits for the x-axis. If None, auto from data. |
None
|
ylim
|
tuple of float
|
(ymin, ymax) limits for the y-axis. If None, auto from data. |
None
|
inputCRS
|
int or str
|
CRS of the input data if not already set on the GeoDataFrame.
Use the constants |
None
|
outputCRS
|
int or str
|
CRS to reproject data before plotting.
Use the constants |
ITM
|
Returns:
| Type | Description |
|---|---|
Axes
|
The axes with the plot. |
Source code in hera/measurements/GIS/vector/demography.py
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 | |
plotPopulation(data, populationType='total_pop', ax=None, figsize=(12, 10), cmap='YlOrRd', vmin=None, vmax=None, alpha=1.0, edgecolor='0.5', linewidth=0.3, colorbar=True, colorbar_label=None, title=None, xlim=None, ylim=None, inputCRS=None, outputCRS=ITM)
¶
Plot absolute population count as a choropleth map.
Example
demo = toolkitHome.getToolkit(toolkitHome.GIS_DEMOGRAPHY, projectName="MY_PROJECT") census = demo.getDataSourceData("census_2020") demo.presentation.plotPopulation(census, cmap="Blues")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
GeoDataFrame
|
The demographic data with geometry and population columns. |
required |
populationType
|
str
|
Column name for the population count (default: |
'total_pop'
|
ax
|
Axes
|
Axes to plot on. If None, creates a new figure. |
None
|
figsize
|
tuple of float
|
Figure size (width, height) in inches. Default: (12, 10). |
(12, 10)
|
cmap
|
str or Colormap
|
Colormap name or instance. Default: |
'YlOrRd'
|
vmin
|
float
|
Minimum value for the color scale. |
None
|
vmax
|
float
|
Maximum value for the color scale. |
None
|
alpha
|
float
|
Transparency (0=transparent, 1=opaque). Default: 1.0. |
1.0
|
edgecolor
|
str
|
Color of polygon edges. Default: |
'0.5'
|
linewidth
|
float
|
Width of polygon edges. Default: 0.3. |
0.3
|
colorbar
|
bool
|
Whether to show a colorbar. Default: True. |
True
|
colorbar_label
|
str
|
Label for the colorbar. If None, uses |
None
|
title
|
str
|
Plot title. |
None
|
xlim
|
tuple of float
|
(xmin, xmax) limits for the x-axis. |
None
|
ylim
|
tuple of float
|
(ymin, ymax) limits for the y-axis. |
None
|
inputCRS
|
int or str
|
CRS of the input data if not already set on the GeoDataFrame.
Use the constants |
None
|
outputCRS
|
int or str
|
CRS to reproject data before plotting.
Use the constants |
ITM
|
Returns:
| Type | Description |
|---|---|
Axes
|
The axes with the plot. |
Source code in hera/measurements/GIS/vector/demography.py
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 | |
plotPopulationByType(data, populationTypes=None, figsize=(16, 10), ncols=3, cmap='YlOrRd', alpha=0.8, edgecolor='0.5', linewidth=0.2, inputCRS=None, outputCRS=ITM)
¶
Plot multiple population types as a grid of subplots.
Example
demo = toolkitHome.getToolkit(toolkitHome.GIS_DEMOGRAPHY, projectName="MY_PROJECT") census = demo.getDataSourceData("census_2020") demo.presentation.plotPopulationByType(census, ncols=3)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
GeoDataFrame
|
The demographic data. |
required |
populationTypes
|
list of str
|
Column names to plot. If None, uses all population types defined in the toolkit. |
None
|
figsize
|
tuple of float
|
Figure size. Default: (16, 10). |
(16, 10)
|
ncols
|
int
|
Number of columns in the subplot grid. Default: 3. |
3
|
cmap
|
str
|
Colormap name. Default: |
'YlOrRd'
|
alpha
|
float
|
Transparency. Default: 0.8. |
0.8
|
edgecolor
|
str
|
Polygon edge color. Default: |
'0.5'
|
linewidth
|
float
|
Polygon edge width. Default: 0.2. |
0.2
|
inputCRS
|
int or str
|
CRS of the input data if not already set on the GeoDataFrame.
Use the constants |
None
|
outputCRS
|
int or str
|
CRS to reproject data before plotting.
Use the constants |
ITM
|
Returns:
| Type | Description |
|---|---|
Figure
|
The figure with all subplots. |
Source code in hera/measurements/GIS/vector/demography.py
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 | |
plotPopulationInPolygon(intersectionResult, queryPolygon=None, contextData=None, populationType='total_pop', ax=None, figsize=(12, 10), cmap='OrRd', contextColor='0.9', alpha=0.8, edgecolor='0.3', linewidth=0.5, colorbar=True, colorbar_label=None, title=None, xlim=None, ylim=None, inputCRS=None, outputCRS=ITM)
¶
Plot the result of calculatePopulationInPolygon.
Shows intersected census areas colored by population, optionally with the query polygon outlined and surrounding census areas as context.
Example
demo = toolkitHome.getToolkit(toolkitHome.GIS_DEMOGRAPHY, projectName="MY_PROJECT") census = demo.getDataSourceData("census_2020") result = demo.analysis.calculatePopulationInPolygon(my_polygon, census) demo.presentation.plotPopulationInPolygon(result, queryPolygon=my_polygon, contextData=census)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intersectionResult
|
GeoDataFrame
|
The result from |
required |
queryPolygon
|
geometry
|
The query polygon to overlay as a dashed outline. |
None
|
contextData
|
GeoDataFrame
|
Full census data to show as gray background context. |
None
|
populationType
|
str
|
Population column to color by. Default: |
'total_pop'
|
ax
|
Axes
|
Axes to plot on. If None, creates a new figure. |
None
|
figsize
|
tuple of float
|
Figure size. Default: (12, 10). |
(12, 10)
|
cmap
|
str
|
Colormap for affected areas. Default: |
'OrRd'
|
contextColor
|
str
|
Fill color for context (unaffected) areas. Default: |
'0.9'
|
alpha
|
float
|
Transparency of affected areas. Default: 0.8. |
0.8
|
edgecolor
|
str
|
Polygon edge color. Default: |
'0.3'
|
linewidth
|
float
|
Polygon edge width. Default: 0.5. |
0.5
|
colorbar
|
bool
|
Whether to show a colorbar. Default: True. |
True
|
colorbar_label
|
str
|
Colorbar label. |
None
|
title
|
str
|
Plot title. |
None
|
xlim
|
tuple of float
|
Axis limits. |
None
|
ylim
|
tuple of float
|
Axis limits. |
None
|
inputCRS
|
int or str
|
CRS of the input data. Use |
None
|
outputCRS
|
int or str
|
CRS to reproject to for plotting. Default: |
ITM
|
Returns:
| Type | Description |
|---|---|
Axes
|
|
Source code in hera/measurements/GIS/vector/demography.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 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 | |
plotArea(areaData, contextData=None, populationType='total_pop', ax=None, figsize=(12, 10), areaColor='steelblue', contextColor='0.9', alpha=0.6, edgecolor='0.3', linewidth=1.0, annotate=True, annotate_fontsize=12, title=None, xlim=None, ylim=None, inputCRS=None, outputCRS=ITM)
¶
Plot a custom area from createNewArea with population annotation.
Example
demo = toolkitHome.getToolkit(toolkitHome.GIS_DEMOGRAPHY, projectName="MY_PROJECT") census = demo.getDataSourceData("census_2020") area = demo.analysis.createNewArea(my_polygon, census) demo.presentation.plotArea(area.getData(), contextData=census, annotate=True)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
areaData
|
GeoDataFrame
|
The result from |
required |
contextData
|
GeoDataFrame
|
Full census data to show as gray background. |
None
|
populationType
|
str
|
Population column to annotate. Default: |
'total_pop'
|
ax
|
Axes
|
Axes to plot on. |
None
|
figsize
|
tuple of float
|
Figure size. Default: (12, 10). |
(12, 10)
|
areaColor
|
str
|
Fill color for the custom area. Default: |
'steelblue'
|
contextColor
|
str
|
Fill color for context areas. Default: |
'0.9'
|
alpha
|
float
|
Transparency of the custom area. Default: 0.6. |
0.6
|
edgecolor
|
str
|
Edge color. Default: |
'0.3'
|
linewidth
|
float
|
Edge width. Default: 1.0. |
1.0
|
annotate
|
bool
|
Whether to annotate with population count. Default: True. |
True
|
annotate_fontsize
|
int
|
Font size for the annotation. Default: 12. |
12
|
title
|
str
|
Plot title. |
None
|
xlim
|
tuple of float
|
Axis limits. |
None
|
ylim
|
tuple of float
|
Axis limits. |
None
|
inputCRS
|
int or str
|
CRS of the input data. Use |
None
|
outputCRS
|
int or str
|
CRS to reproject to. Default: |
ITM
|
Returns:
| Type | Description |
|---|---|
Axes
|
|
Source code in hera/measurements/GIS/vector/demography.py
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 | |
plotPopulationOnMap(data, tilesToolkit, populationType='total_pop', density=True, density_units=None, zoomlevel=14, tileServer=None, ax=None, figsize=(14, 12), cmap='YlOrRd', vmin=None, vmax=None, alpha=0.5, edgecolor='0.3', linewidth=0.3, colorbar=True, colorbar_label=None, title=None, inputCRS=None, outputCRS=ITM)
¶
Overlay population density on a tile server map background.
Fetches map tiles for the data extent and overlays the population choropleth with transparency.
Example
demo = toolkitHome.getToolkit(toolkitHome.GIS_DEMOGRAPHY, projectName="MY_PROJECT") tiles = toolkitHome.getToolkit(toolkitHome.GIS_TILES, projectName="MY_PROJECT") census = demo.getDataSourceData("census_2020") demo.presentation.plotPopulationOnMap(census, tiles, density=True, alpha=0.5)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
GeoDataFrame
|
The demographic data. |
required |
tilesToolkit
|
TilesToolkit
|
An initialized Tiles toolkit for fetching map images.
Get via |
required |
populationType
|
str
|
Population column to plot. Default: |
'total_pop'
|
density
|
bool
|
If True, plot population density. If False, plot absolute counts. Default: True. |
True
|
density_units
|
Unit
|
Area unit for density (e.g., |
None
|
zoomlevel
|
int
|
Tile server zoom level (higher = more detail). Default: 14. |
14
|
tileServer
|
str
|
Tile server URL or datasource name. If None, uses default. |
None
|
ax
|
Axes
|
Axes to plot on. |
None
|
figsize
|
tuple of float
|
Figure size. Default: (14, 12). |
(14, 12)
|
cmap
|
str
|
Colormap for the population overlay. Default: |
'YlOrRd'
|
vmin
|
float
|
Color scale range. |
None
|
vmax
|
float
|
Color scale range. |
None
|
alpha
|
float
|
Transparency of the population overlay (0=transparent, 1=opaque). Default: 0.5. Lower values show more of the map underneath. |
0.5
|
edgecolor
|
str
|
Polygon edge color. Default: |
'0.3'
|
linewidth
|
float
|
Polygon edge width. Default: 0.3. |
0.3
|
colorbar
|
bool
|
Whether to show a colorbar. Default: True. |
True
|
colorbar_label
|
str
|
Colorbar label. |
None
|
title
|
str
|
Plot title. |
None
|
inputCRS
|
int or str
|
CRS of the input data. Use |
None
|
outputCRS
|
int or str
|
CRS for the output plot. Default: |
ITM
|
Returns:
| Type | Description |
|---|---|
Axes
|
|
Source code in hera/measurements/GIS/vector/demography.py
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 | |
DemographyToolkit — Analysis¶
hera.measurements.GIS.vector.demography.analysis
¶
Analysis of the demography toolkit.
Source code in hera/measurements/GIS/vector/demography.py
159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 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 | |
datalayer
property
¶
DemographyToolkit : Reference to the parent data layer.
__init__(dataLayer)
¶
Initialize the demography analysis with a reference to the data layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataLayer
|
DemographyToolkit
|
The parent demography toolkit instance. |
required |
Source code in hera/measurements/GIS/vector/demography.py
createNewArea(shapeNameOrData, dataSourceOrData, dataSourceVersion=None, populationTypes=None, convex=True, saveMode=TOOLKIT_SAVEMODE_NOSAVE, regionName=None, metadata=dict())
¶
Make a geoDataFrame with a polygon as the geometry,
and the sum of the population in the polygons that intersect it as its population.
If saveMode is set to save to file (with or without DB) the regionName
is used as the file name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shapeNameOrData
|
A shape name, geopandas dataframe, geoJSON str |
required | |
dataSourceOrData
|
A demography data source name, a geoJSON (shapes with the population) or geopandas.dataframe |
required | |
dataSourceVersion
|
A version of the demography data source |
None
|
|
convex
|
|
True
|
|
saveMode
|
|
TOOLKIT_SAVEMODE_NOSAVE
|
|
regionName
|
optional. If saved to the DB, use this as a region. |
None
|
|
metadata
|
Metadata to be saved to the DB if needed. |
dict()
|
Returns:
| Type | Description |
|---|---|
Document with the new data
|
|
Source code in hera/measurements/GIS/vector/demography.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 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 | |
calculatePopulationInPolygon(shapelyPolygon, dataSourceOrData, dataSourceVersion=None, populationTypes=None)
¶
Finds the population in a polygon.
Parameters:
shapeNameOrData: str, shapely.Polygon, geopandas
The polygon to calculate the poulation in.
Can be either:
- the polygon itself (shapely.Polygon)
- shape name in the DB (str)
- geoJSON (str)
- geopandas.
dataSourceOrData: str or geopandas
The demographic data.
Can be either:
- demography data source name
- geoJSON (str)
- geopandas
dataSourceVersion: 3-tuple of int
If dataSourceOrData is demography data source name
then dataSourceVersion is a possible version.
populationTypes: str or list of str
Additional population columns that will be calculated.
Returns:
| Type | Description |
|---|---|
geopandas
|
The intersection of the demography and the polygon. |
Source code in hera/measurements/GIS/vector/demography.py
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 | |
GIS - Raster¶
TopographyToolkit (Raster)¶
hera.measurements.GIS.raster.topography.TopographyToolkit
¶
Bases: abstractToolkit
Toolkit for raster-based topography and elevation operations.
Source code in hera/measurements/GIS/raster/topography.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 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 | |
__init__(projectName, filesDirectory=None, connectionName=None)
¶
Initializes the TopographyToolkit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
str
|
The project Name that the toolkit is initialized on. |
required |
filesDirectory
|
str or None
|
The path to save region files when they are created.
|
None
|
Source code in hera/measurements/GIS/raster/topography.py
findElevationFile(filename, dataSourceName)
¶
Attempts to find the .hgt file in one of the registered resource folders. Supports both single path or list of paths.
Source code in hera/measurements/GIS/raster/topography.py
getPointElevation(lat, long, dataSourceName=None)
¶
get the elevation above sea level in meters from DEM for a point
SRTM30 means 30 meters resolution
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat
|
float
|
Latitiute in the WSG projection |
required |
long
|
float
|
Longitude in the WSG projection |
required |
dataSourceName
|
The name of the datasources loaded. Use getDataSourceList to see which datasource were loaded. |
None
|
Returns:
| Type | Description |
|---|---|
eleveation above sea level
|
|
How to use
from hera import toolkitHome tk = toolkitHome.getToolkit(toolkitName=toolkitHome.GIS_RASTER) tk.getPointElevation(lat = 33.459,long = 35.755)
This should return ~ ~820 according to amud anan.
Source code in hera/measurements/GIS/raster/topography.py
getPointListElevation(pointList, dataSourceName=None, inputCRS=WSG84)
¶
Return the elevation of the point list.
For now we assume that pointList is in WSG84 coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latList
|
|
required | |
longList
|
|
required | |
dataSourceName
|
|
None
|
Source code in hera/measurements/GIS/raster/topography.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
convertPointsCRS(points, inputCRS, outputCRS, **kwargs)
¶
Convert list/array/DataFrame of points from one CRS to another, using GeoPandas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list of tuples, numpy array, or pandas.DataFrame
|
Points to convert. |
required |
inputCRS
|
int
|
EPSG code of input coordinate system. |
required |
outputCRS
|
int
|
EPSG code of output coordinate system. |
required |
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
Converted points with 'geometry' column. |
Source code in hera/measurements/GIS/raster/topography.py
create_xarray(minx, miny, maxx, maxy, dxdy=30, inputCRS=WSG84)
¶
Create an xarray grid of lat/lon points within the given bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minx
|
float
|
Bounding box coordinates. |
required |
miny
|
float
|
Bounding box coordinates. |
required |
maxx
|
float
|
Bounding box coordinates. |
required |
maxy
|
float
|
Bounding box coordinates. |
required |
dxdy
|
float
|
Grid spacing (in meters for ITM or degrees for WGS84). |
30
|
inputCRS
|
int
|
EPSG code of the coordinate system (default is WGS84). |
WSG84
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset containing lat/lon coordinates over the i, j grid. |
Notes
✅ Added memory guard: throws an error if grid is larger than 1,000,000 points.
Source code in hera/measurements/GIS/raster/topography.py
getElevation(minx, miny, maxx, maxy, dxdy=30, inputCRS=WSG84, dataSourceName=None)
¶
Generates elevation data over a rectangular area using given resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minx
|
float
|
Bounding box coordinates of the area to analyze. |
required |
miny
|
float
|
Bounding box coordinates of the area to analyze. |
required |
maxx
|
float
|
Bounding box coordinates of the area to analyze. |
required |
maxy
|
float
|
Bounding box coordinates of the area to analyze. |
required |
dxdy
|
float
|
Resolution (spacing) in coordinate units (default is 30). |
30
|
inputCRS
|
CRS
|
Coordinate reference system of the input coordinates. |
WSG84
|
dataSourceName
|
str
|
Name of the data source to fetch elevations from. |
None
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with 'lat', 'lon' and calculated 'elevation' layer. |
Notes
🔧 FIXED: Replaced xarray_dataset.shape access with .shape from 'lat' variable, since xarray.Dataset has no shape attribute.
Source code in hera/measurements/GIS/raster/topography.py
getElevationOfXarray(xarray_dataset, dataSourceName=None)
¶
Computes elevation values for each (lat, lon) point in an xarray dataset and returns the same dataset with an added 'elevation' coordinate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xarray_dataset
|
Dataset
|
Dataset with 'lat' and 'lon' variables defined over dimensions ['i', 'j'] |
required |
dataSourceName
|
str
|
Name of the data source to use. If not given, will be extracted from config. |
None
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Same dataset with added 'elevation' coordinate over ['i', 'j'] |
Notes
🔧 FIXED: previously tried to access xarray_dataset.shape which doesn't exist on Dataset.
Now correctly gets shape from 'lat' variable.
Source code in hera/measurements/GIS/raster/topography.py
createElevationSTL(minx, miny, maxx, maxy, dxdy=30, shiftx=0, shifty=0, inputCRS=WSG84, dataSourceName=None, solidName='Topography')
¶
Return the STL string from xarray dataset with the following fields:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lowerleft_point
|
float
|
|
required |
upperright_point
|
|
required | |
dxdy
|
float
|
|
30
|
inputCRS
|
The ESPG code of the input projection.
|
|
WSG84
|
outputCRS
|
The ESPG code of the output projection.
|
|
required |
shiftx
|
Used when one wants to set another point as origin center
|
|
0
|
shifty
|
Used when one wants to set another point as origin center
|
|
0
|
Source code in hera/measurements/GIS/raster/topography.py
getElevationSTL(elevation, shiftx=0, shifty=0, solidName='Topography')
¶
Generates STL string from elevation dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
elevation
|
Dataset
|
Dataset with 'lat', 'lon' and 'elevation' coordinates. |
required |
shiftx
|
float
|
Optional shifts in X and Y. |
0
|
shifty
|
float
|
Optional shifts in X and Y. |
0
|
solidName
|
str
|
Name of the STL solid. |
'Topography'
|
Returns:
| Type | Description |
|---|---|
str
|
STL content as string. |
Notes
🔧 FIXED: Accessed shape using elevation['elevation'].shape instead of elevation.shape because xarray.Dataset has no attribute 'shape'.
Source code in hera/measurements/GIS/raster/topography.py
LandCoverToolkit¶
hera.measurements.GIS.raster.landcover.LandCoverToolkit
¶
Bases: abstractToolkit
Toolkit for land cover data retrieval, roughness calculation, and mapping.
Source code in hera/measurements/GIS/raster/landcover.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 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 | |
__init__(projectName, filesDirectory=None, connectionName=None)
¶
Initializes land cover data toolkit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
The project Name that the toolkit is initialized on |
required | |
toolkitName
|
the specific toolkit, getting from the child. |
required | |
FilesDirectory
|
The path to save a regions files when they are created. if str then represents a path (relative or absolute) to save the files in. The directory is created automatically. if None, then tries to get the default path of the project from the config. if it does not exist, then use the current directory. |
required |
Source code in hera/measurements/GIS/raster/landcover.py
getLandCoverAtPoint(lon, lat, inputCRS=WSG84, dataSourceName=None)
¶
Get the landcover type integer value in a specific point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lon
|
float
|
The longitude coordinate. |
required |
lat
|
float
|
The latitude coordinate. |
required |
inputCRS
|
int
|
The EPSG of the input coordinates. |
WSG84
|
dataSourceName
|
string
|
The name or path of the data source to use. |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Land cover integer value at the point. |
Source code in hera/measurements/GIS/raster/landcover.py
getLandCover(minx, miny, maxx, maxy, dxdy=30, inputCRS=WSG84, dataSourceName=None)
¶
Get Xarray LandCover map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minx
|
float
|
Minimum value of X axis. If using WSG84 - the minimum Latitude coordinates. |
required |
miny
|
float
|
Minimum value of Y axis. If using WSG84 - the minimum Longitude coordinates. |
required |
maxx
|
Maximum value of X axis. If using WSG84 - the maximum Latitude coordinates. |
required | |
maxy
|
Maximum value of Y axis. If using WSG84 - the maximum Longitude coordinates. |
required | |
dxdy
|
Spatial resolution of the output land cover map. |
30
|
|
inputCRS
|
int
|
The EPSG of the coordinates. |
WSG84
|
dataSourceName
|
string
|
The name of the data source to use. |
None
|
Returns:
| Type | Description |
|---|---|
DataArray
|
|
Source code in hera/measurements/GIS/raster/landcover.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 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 | |
getRoughnessAtPoint(lon, lat, inputCRS=WSG84, dataSourceName=None)
¶
Get the roughness value of a specific point in the map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lon
|
float
|
The longitude coordinates. |
required |
lat
|
float
|
The latitude coordinates. |
required |
inputCRS
|
int
|
The EPSG of the coordinates. |
WSG84
|
dataSourceName
|
string
|
The name of the data source to use. |
None
|
Returns:
| Type | Description |
|---|---|
float
|
|
Source code in hera/measurements/GIS/raster/landcover.py
getRoughnessFromLandcover(landcover, windMeteorologicalDirection=None, resolution=None, isBuilding=False, dataSourceName=None, GIS_BUILDINGS_dataSourceName=None)
¶
Adds Roughness field (z0) to landcover Xarray.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
landcover
|
Xarray
|
Landcover Xarray map in which the Roughness field will be added to. |
required |
windMeteorologicalDirection
|
The meteorological angle. Must be specified only if data includes urbanic area. |
None
|
|
resolution
|
The size of the squares. Must be specified only if data includes urbanic area. |
None
|
|
isBuilding
|
bool
|
Is the landcover contains urbanic area. |
False
|
dataSourceName
|
string
|
The name of the data source to use. |
None
|
GIS_BUILDINGS_dataSourceName
|
The name of the GIS Buildings datasource name. Relevant if landcover contains Urban areas. |
None
|
Returns:
| Type | Description |
|---|---|
DataArray
|
|
Source code in hera/measurements/GIS/raster/landcover.py
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 | |
getRoughness(minx, miny, maxx, maxy, dxdy=30, inputCRS=WSG84, dataSourceName=None, isBuilding=False, windMeteorologicalDirection=None, resolution=None, GIS_BUILDINGS_dataSourceName=None)
¶
Returns Xarray LandCover map with Roughness (zo) field. Just as applying getLandCover and getRoughnessFromLandcover at the same time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minx
|
float
|
Minimum value of X axis. If using WSG84 - the minimum Latitude coordinates. |
required |
miny
|
float
|
Minimum value of Y axis. If using WSG84 - the minimum Longitude coordinates. |
required |
maxx
|
float
|
Maximum value of X axis. If using WSG84 - the maximum Latitude coordinates. |
required |
maxy
|
float
|
Maximum value of Y axis. If using WSG84 - the maximum Longitude coordinates. |
required |
dxdy
|
int
|
Spatial resolution of the output land cover map. |
30
|
inputCRS
|
int
|
The EPSG of the coordinates. |
WSG84
|
dataSourceName
|
string
|
The name of the data source to use. |
None
|
isBuilding
|
bool
|
Is the landcover contains building area. |
False
|
windMeteorologicalDirection
|
The meteorological angle. Must be specified only if data includes urbanic area. |
None
|
|
resolution
|
The size of the squares. Must be specified only if data includes urbanic area. |
None
|
Returns:
| Type | Description |
|---|---|
DataArray
|
|
Source code in hera/measurements/GIS/raster/landcover.py
getCodingMap(datasourceName)
¶
Returns dictionary that maps landcover int value to string of landcover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datasourceName
|
str
|
Datasource type (Type-1, Type-2 etc.) |
required |
Returns:
| Type | Description |
|---|---|
dict
|
|
Source code in hera/measurements/GIS/raster/landcover.py
roughnesslength2sandgrainroughness(rl)
staticmethod
¶
Convert roughness length to equivalent sand grain roughness (Ks = z0 * 30).
Source code in hera/measurements/GIS/raster/landcover.py
TilesToolkit¶
hera.measurements.GIS.raster.tiles.TilesToolkit
¶
Bases: abstractToolkit
A class to handle an image that represents a location. Looks up the location in the public database in project 'imageLocation'.
Source code in hera/measurements/GIS/raster/tiles.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 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 | |
doctype
property
¶
Return the document type string for tile images.
__init__(projectName, filesDirectory=None, connectionName=None)
¶
Initialize the TilesToolkit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
str
|
The project name to initialize the toolkit on. |
required |
filesDirectory
|
str or None
|
Path to save tile files. Uses default if None. |
None
|
connectionName
|
str or None
|
Name of the database connection. |
None
|
Source code in hera/measurements/GIS/raster/tiles.py
tileScaleAtLatLonZoom(latitude, longitude, zoomlevel)
¶
Returns the scale of a tile im meters at the location and zoom level
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
The latitude in WGS84 |
required |
longitude
|
float
|
The longitude in WGS |
required |
zoomlevel
|
int
|
The zoom to retrieve. usually up to ~19. (highest). |
required |
Returns:
| Type | Description |
|---|---|
float
|
|
Source code in hera/measurements/GIS/raster/tiles.py
getImageFromCorners(minx, miny, maxx, maxy, zoomlevel, tileServer=None, inputCRS=WSG84, outputCRS=WSG84)
¶
Gets the image from the lower left corner and upper right cornet - [left,right,bottom,top] in the coordinate system of the outputCRS. The lowerLeft,upperRight are given in WGS84 (degrees) if dgrees are True and in Israel 1993 / Israeli TM Grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minx
|
Minimux X coordinate value of the image. |
required | |
miny
|
Minimux Y coordinate value of the image. |
required | |
maxx
|
Maximum X coordinate value of the image. |
required | |
maxy
|
Maximum X coordinate value of the image. |
required | |
zoomlevel
|
int
|
The zoom to retrieve. usually up to ~19. (highest). |
required |
tileServer
|
string
|
The tile server. If None, get the default one (defaultTileServer in the config) |
None
|
inputCRS
|
int,default=WSG84
|
The ESPG of the input coordinates. |
WSG84
|
outputCRS
|
The ESPG of the output coordinates. |
WSG84
|
Returns:
| Type | Description |
|---|---|
tuple
|
|
Source code in hera/measurements/GIS/raster/tiles.py
tile2deg(xtile, ytile, zoom)
¶
Convert tile coordinates to WGS84 latitude/longitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xtile
|
int
|
Tile x and y indices. |
required |
ytile
|
int
|
Tile x and y indices. |
required |
zoom
|
int
|
Zoom level. |
required |
Returns:
| Type | Description |
|---|---|
tuple of float
|
(latitude, longitude) in degrees. |
Source code in hera/measurements/GIS/raster/tiles.py
deg2tile(lat_deg, lon_deg, zoom)
¶
Convert WGS84 latitude/longitude to tile coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat_deg
|
float
|
Latitude and longitude in degrees. |
required |
lon_deg
|
float
|
Latitude and longitude in degrees. |
required |
zoom
|
int
|
Zoom level. |
required |
Returns:
| Type | Description |
|---|---|
tuple of int
|
(xtile, ytile) tile indices. |
Source code in hera/measurements/GIS/raster/tiles.py
listImages(**filters)
¶
setDefaultTileServer(server)
¶
Set the default tile server URL in the project config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server
|
str
|
URL template for the tile server. |
required |
Source code in hera/measurements/GIS/raster/tiles.py
Meteorology¶
lowFreqToolKit¶
hera.measurements.meteorology.lowfreqdata.toolkit.lowFreqToolKit
¶
Bases: abstractToolkit
Manages the loading and storing of low frequency meteorological data
The data can be in the formats:
- TOAA
- IMS_JSON
TODO: Complete the other parsers from the older versions.
Source code in hera/measurements/meteorology/lowfreqdata/toolkit.py
__init__(projectName, filesDirectory=None, connectionName=None)
¶
Initializes a datalayer for the lowfreqdata data.
Also looks up the 'IMSData' in the public database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
|
required |
Source code in hera/measurements/meteorology/lowfreqdata/toolkit.py
HighFreqToolKit¶
hera.measurements.meteorology.highfreqdata.toolkit.HighFreqToolKit
¶
Bases: abstractToolkit
Toolkit for high-frequency (10–20 Hz) sonic anemometer and TRH data.
Manages parsing raw binary/ASCII sensor files, normalising the output, storing data as versioned data sources in the project, and providing an analysis layer for turbulence statistics.
Supported raw formats:
- Campbell Scientific TOB1 binary — via :class:
Parser - Campbell Scientific TOA5 ASCII — via :class:
ASCIIParser
Source code in hera/measurements/meteorology/highfreqdata/toolkit.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 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 | |
docType
property
¶
str : Document type identifier for high-frequency data.
__init__(projectName, filesDirectory=None, connectionName=None)
¶
Initialise the high-frequency meteorology toolkit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
str
|
The project name. |
required |
filesDirectory
|
str
|
Directory for saving parquet files. If |
None
|
connectionName
|
str
|
Database connection name. |
None
|
Source code in hera/measurements/meteorology/highfreqdata/toolkit.py
parseData(path, fromTime=None, toTime=None, parser='auto')
¶
Parse a raw data file and return normalised DataFrames.
Automatically detects the file format (Campbell binary vs TOA5
ASCII) unless parser is specified explicitly. The output is
normalised to the standard column format expected by the analysis
layer (lowercase u, v, w, T with a DatetimeIndex).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to a raw data file or a directory of files. |
required |
fromTime
|
str or None
|
Start time filter. |
None
|
toTime
|
str or None
|
End time filter. |
None
|
parser
|
str
|
Parser to use: |
'auto'
|
Returns:
| Type | Description |
|---|---|
list of tuple(pandas.DataFrame, dict)
|
Each element is |
Source code in hera/measurements/meteorology/highfreqdata/toolkit.py
loadData(name, path, outputDirectory, fromTime=None, toTime=None, parser='auto', version=(0, 0, 1), overwrite=False, append=False, metadata=None)
¶
Parse a raw data file, save as parquet, and register as a data source.
This is the recommended way to ingest new high-frequency data. It parses, normalises, writes a parquet file, and registers the result as a versioned data source in the project.
If a data source with the same name already exists in the DB:
- append=True: loads the existing parquet, concatenates the new data, and saves back to the same file.
- overwrite=True: replaces the existing file and document.
- Both
False(default): raisesValueError. - Both
True: raisesValueError(mutually exclusive).
If the data source does not exist, a new file is created using the project counter to generate a unique filename.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Data source name (e.g. |
required |
path
|
str
|
Path to a raw data file or directory to parse. |
required |
outputDirectory
|
str
|
Directory where the parquet file will be stored. |
required |
fromTime
|
str or None
|
Start time filter. |
None
|
toTime
|
str or None
|
End time filter. |
None
|
parser
|
str
|
|
'auto'
|
version
|
tuple of int
|
Data source version |
(0, 0, 1)
|
overwrite
|
bool
|
If |
False
|
append
|
bool
|
If |
False
|
metadata
|
dict
|
User-controlled metadata to store with the data source. |
None
|
Returns:
| Type | Description |
|---|---|
document or list of documents
|
The created/updated data source document(s). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If both overwrite and append are |
Source code in hera/measurements/meteorology/highfreqdata/toolkit.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 | |
campbelToParquet(binaryFile, fromTime=None, toTime=None, chunkSize=10000)
¶
Parse a Campbell binary file and return a normalised DataFrame.
.. deprecated::
Use :meth:parseData or :meth:loadData instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
binaryFile
|
str
|
Path to the Campbell binary |
required |
fromTime
|
str or None
|
Start time filter. |
None
|
toTime
|
str or None
|
End time filter. |
None
|
chunkSize
|
int
|
Records per batch (default 10000). |
10000
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Normalised DataFrame with lowercase columns and DatetimeIndex. |
Source code in hera/measurements/meteorology/highfreqdata/toolkit.py
asciiToParquet(path, fromTime=None, toTime=None)
¶
Parse a TOA5 ASCII file and return normalised DataFrames.
.. deprecated::
Use :meth:parseData or :meth:loadData instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to a |
required |
fromTime
|
str or None
|
Start time filter. |
None
|
toTime
|
str or None
|
End time filter. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Mapping of device names to normalised DataFrames. |
Source code in hera/measurements/meteorology/highfreqdata/toolkit.py
Experiment¶
experimentHome¶
hera.measurements.experiment.experiment.experimentHome
¶
Bases: abstractToolkit
This object functions as a factory/home for the other experiments. It is responsible for getting the right toolkit for the requested experiment.
Source code in hera/measurements/experiment/experiment.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
experimentMap
property
¶
Backward-compatibility alias. Historically this was a property, so we keep the interface, even though today the real logic is in getExperimentsMap().
experimentsTable
property
¶
Return a tabular view (DataFrame-like) of experiment datasources.
__init__(projectName, filesDirectory=None, connectionName=None)
¶
Initialize the experiment home factory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectName
|
str
|
Name of the project. |
required |
filesDirectory
|
str
|
Directory for cache/intermediate files. |
None
|
connectionName
|
str
|
Name of the database connection to use. |
None
|
Source code in hera/measurements/experiment/experiment.py
getExperimentsMap()
¶
Get a dictionary mapping experiment name -> datasource document.
Returns:
| Type | Description |
|---|---|
dict
|
Keys are experiment names (datasourceName), values are the matching datasource documents. |
Source code in hera/measurements/experiment/experiment.py
getExperimentsTable()
¶
getExperiment(experimentName, filesDirectory=None)
¶
Get the specific experiment class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experimentName
|
str
|
The name of the experiment. |
required |
filesDirectory
|
str
|
The directory to save cache/intermediate files. If None, uses the current working directory / 'experimentCache'. |
None
|
Returns:
| Type | Description |
|---|---|
experimentSetupWithData
|
|
Source code in hera/measurements/experiment/experiment.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 198 199 200 201 202 203 | |
keys()
¶
Get the experiment names of the project.
Returns:
| Type | Description |
|---|---|
list of str
|
|