bgc_data_processing.core.loaders.abfile_loaders
¶
ABfiles Loaders.
ABFileLoader(provider_name, category, exclude, variables, grid_basename)
¶
Bases: BaseLoader
Loader class to use with ABFiles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider_name |
str
|
Data provider name. |
required |
category |
str
|
Category provider belongs to. |
required |
exclude |
list[str]
|
Filenames to exclude from loading. |
required |
variables |
SourceVariableSet
|
Storer object containing all variables to consider for this data, both the one in the data file but and the one not represented in the file. |
required |
grid_basename |
str
|
Basename of the ab grid grid file for the loader. => files are considered to be loaded over the same grid. |
required |
Source code in src/bgc_data_processing/core/loaders/abfile_loaders.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
level_column: str = 'LEVEL'
class-attribute
instance-attribute
¶
level_key_bfile: str = 'k'
class-attribute
instance-attribute
¶
field_key_bfile: str = 'field'
class-attribute
instance-attribute
¶
pascal_by_seawater_meter: int = 9806
class-attribute
instance-attribute
¶
grid_basename = grid_basename
instance-attribute
¶
grid_file = ABFileGrid(basename=grid_basename, action='r')
instance-attribute
¶
convert_filepath_to_basename(filepath)
staticmethod
¶
Convert a filepath to the basename.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath |
Path | str
|
Filepath ot convert. |
required |
Returns:
Type | Description |
---|---|
Path
|
Basename |
Source code in src/bgc_data_processing/core/loaders/abfile_loaders.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
load(filepath, constraints=None)
¶
Load a abfiles from basename.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath |
Path | str
|
Path to the basename of the file to load. |
required |
constraints |
Constraints | None
|
Constraints slicer., by default None |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
DataFrame corresponding to the file. |
Source code in src/bgc_data_processing/core/loaders/abfile_loaders.py
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 |
|
is_file_valid(filepath)
¶
Check whether a file is valid or not.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath |
Path | str
|
File filepath. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the file can be loaded. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the afile doesn't not exist. |
FileNotFoundError
|
If the bfile doesn't not exist. |
Source code in src/bgc_data_processing/core/loaders/abfile_loaders.py
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 |
|