conventions
¶
Naming conventions for the EFTS netCDF file format.
TYPES_CONVERTIBLE_TO_TIMESTAMP
module-attribute
¶
Definition of a 'type' for type hints.
check_hydrologic_variables
¶
Checks if the variable names and attributes in a netCDF file comply with the STF convention.
Parameters:
-
file_path
(str
) –The path to the netCDF file.
Returns:
-
Dict[str, List[str]]
–Dict[str, List[str]]: A dictionary with keys "INFO", "WARNING", "ERROR" and values as lists of strings describing compliance issues.
Source code in src/efts_io/conventions.py
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 |
|
check_index_found
¶
Helper function to check that a value (index) was is indeed found in the dimension.
Source code in src/efts_io/conventions.py
154 155 156 157 158 159 160 161 162 163 164 |
|
check_optional_variable_attributes
¶
check_optional_variable_attributes(
variable: Any,
error_threshold: AttributesErrorLevel = AttributesErrorLevel.NONE,
) -> List[str]
Checks if the attributes of the observed variable comply with the conventions.
Source code in src/efts_io/conventions.py
542 543 544 545 546 547 548 549 550 551 552 553 |
|
check_stf_compliance
¶
Checks the compliance of a netCDF file with the STF convention.
Parameters:
-
file_path
(str
) –The path to the netCDF file.
Returns:
-
Dict[str, List[str]]
–Dict[str, List[str]]: A dictionary with keys "INFO", "WARNING", "ERROR" and values as lists of strings describing compliance issues.
Source code in src/efts_io/conventions.py
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 |
|
convert_to_datetime64_utc
¶
convert_to_datetime64_utc(
x: ConvertibleToTimestamp,
) -> datetime64
Converts a known timestamp representation an np.datetime64.
Source code in src/efts_io/conventions.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 |
|
exportable_to_stf2
¶
exportable_to_stf2(data: MdDatasetsType) -> bool
Check if the dataset can be written to a netCDF file compliant with STF 2.0 specification.
This method checks if the underlying xarray dataset or dataarray has the required dimensions and global attributes as specified by the STF 2.0 convention.
Returns:
-
bool
(bool
) –True if the dataset can be written to a STF 2.0 compliant netCDF file, False otherwise.
Source code in src/efts_io/conventions.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
|
get_default_dim_order
¶
Default order of dimensions in the netCDF file.
Returns:
Source code in src/efts_io/conventions.py
140 141 142 143 144 145 146 147 148 149 150 151 |
|
has_required_global_attributes
¶
has_required_global_attributes(d: MdDatasetsType) -> bool
has_required_global_attributes.
Source code in src/efts_io/conventions.py
224 225 226 227 228 229 230 231 232 |
|
has_required_stf2_dimensions
¶
has_required_stf2_dimensions(
d: MdDatasetsType,
mandatory_dimensions: Optional[Iterable[str]] = None,
) -> bool
Has the dataset the required dimensions for STF conventions.
Parameters:
-
d
(MdDatasetsType
) –data object to check
Returns:
-
bool
(bool
) –Has it the minimum STF dimentions
Source code in src/efts_io/conventions.py
200 201 202 203 204 205 206 207 208 209 210 |
|
has_required_variables_xr
¶
has_required_variables_xr(d: MdDatasetsType) -> bool
has_required_variables.
Source code in src/efts_io/conventions.py
235 236 237 238 239 240 241 242 |
|
has_required_xarray_dimensions
¶
has_required_xarray_dimensions(d: MdDatasetsType) -> bool
Has the dataset the required dimensions for an in memory xarray representation.
Source code in src/efts_io/conventions.py
213 214 215 |
|