base
Processor
Bases: DataCollection
An abstract base class for data processing classes.
Provides methods for initialising source data from download-toolbox defined configurations, process the data, and saving the processed data to normalised netCDF files.
TODO: the majority of actual data processing, for the moment, is being isolated in the child implementation of NormalisingChannelProcessor whilst I work out what is going on regarding the relevant processing and the inheritance hierarchy that support future, diverse implementations for alternative data types not based on xarray
Source code in preprocess_toolbox/base.py
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 | |
processed_files
property
A dict with the processed files organised by variable name.
__init__(dataset_config, absolute_vars, identifier, base_path=os.path.join('.', 'processed'), config_path=None, dtype=np.float32, processed_files=None, update_key=None, **kwargs)
Args: dataset_config: absolute_vars: identifier: base_path: dtype: update_key: **kwargs:
Source code in preprocess_toolbox/base.py
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 | |
get_data_var_folder(var_name, append=None, missing_error=False)
Returns the path for a specific data variable.
Appends additional folders to the path if specified in the append parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
var_name
|
str
|
The data variable. |
required |
append
|
object
|
Additional folders to append to the path. |
None
|
missing_error
|
bool
|
Flag to specify if missing directories should be treated as an error. |
False
|
Returns:
| Type | Description |
|---|---|
PathLike
|
The path for the specific data variable. |
Source code in preprocess_toolbox/base.py
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 | |
save_processed_file(var_name, name, data, convert=True, overwrite=False)
Save processed data to netCDF file.
Args: var_name: The name of the variable. name: The name of the file. data: The data to be saved. convert: Whether to convert data to the processors data type overwrite: Whether to overwrite extant files
Returns: object: The path of the saved netCDF file.
Source code in preprocess_toolbox/base.py
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 | |