API Utilities
These functionalities are supporting capabilities, documented for convienence.
format_pandas_for_logging(pandas_df, title, line_tab_prefix='\t\t')
Helper function facilitating outputting a :class:Pandas DataFrame<pandas.DataFrame> into a logfile. This function only
formats the data frame into text for output. It should be used in conjunction with a logging method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pandas_df
|
DataFrame
|
Pandas |
required |
title
|
str
|
String title describing the data frame. |
required |
line_tab_prefix
|
Optional string comprised of tabs ( |
'\t\t'
|
Source code in src/arcpy_parquet/utils/logging_utils.py
get_logger(level='INFO', logger_name=None, logfile_path=None, propagate=True)
Get Python Logger configured to provide stream, file or, if available, ArcPy output.
The way the method is set up, logging will be routed through ArcPy if ArcPy is available. If ArcPy is not
available, messages will be sent to the console using a StreamHandler. Next, if
the logfile_path is provided, log messages will also be written to the provided path to a logfile using
a FileHandler.
Valid log_level inputs include:
DEBUG- Detailed information, typically of interest only when diagnosing problems.INFO- Confirmation that things are working as expected.WARNING- An indication that something unexpected happened, or indicative of some problem in the near future (e.g. "disk space low"). The software is still working as expected.ERROR- Due to a more serious problem, the software has not been able to perform some function.CRITICAL- A serious error, indicating that the program itself may be unable to continue running.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
Optional[Union[str, int]]
|
Logging level to use. Default is |
'INFO'
|
logger_name
|
Optional[str]
|
Optional logger name to use. If not provided, gets and returns default logger. |
None
|
logfile_path
|
Union[Path, str]
|
Where to save the logfile if file output is desired. |
None
|
propagate
|
bool
|
Whether to propagate messages up to the default logger or not. |
True
|
# only output to console and potentially Pro if ArcPy is available
configure_logging('DEBUG')
logging.debug('nauseatingly detailed debugging message')
logging.info('something actually useful to know')
logging.warning('The sky may be falling')
logging.error('The sky is falling.)
logging.critical('The sky appears to be falling because a giant meteor is colliding with the earth.')
Source code in src/arcpy_parquet/utils/logging_utils.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 | |
ensure_parquet_dataset(parquet_dataset)
Ensure the input is a ParquetDataset object.
Source code in src/arcpy_parquet/utils/parquet.py
get_geoparquet_bbox(parquet_dataset)
For a Geoparquet dataset, get the full maximum bounding box.
Source code in src/arcpy_parquet/utils/parquet.py
get_parquet_max_string_lengths(parquet_dataset)
For a Parquet dataset, get the maximum string lengths for all string columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parquet_dataset
|
Union[str, Path, ParquetDataset]
|
Path to Parquet dataset. |
required |
Source code in src/arcpy_parquet/utils/parquet.py
get_spatial_reference_projjson(spatial_reference)
Get the PROJJSON representation of a Spatial Reference.
!!! note:
Spatial reference can be submitted as either an `arcpy.SpatialReference` object, dictionary with the
well known identifier (WKID) or the integer well known identifier. For instance, for WGS84, this can
be one of the following:
* `arcpy.SpatialReference(4326)`
* `{'wkid': 4326}`
* `4326`
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spatial_reference
|
Union[int, dict, SpatialReference]
|
The spatial reference to get the PROJJSON for. |
required |