(target_variable: Union[str, List[str]])
| 287 | |
| 288 | |
| 289 | def get_target_variable(target_variable: Union[str, List[str]]) -> List[str]: |
| 290 | if isinstance(target_variable, list): |
| 291 | if len(target_variable) == 1 and 'flux' in target_variable[0]: |
| 292 | target_variable = target_variable[0] |
| 293 | else: |
| 294 | return target_variable |
| 295 | target_variable2 = target_variable.lower().replace('&', '+').replace('-', '').replace('_', '') |
| 296 | target_variable2 = target_variable2.replace('fluxes', 'flux').replace('heatingrate', 'hr') |
| 297 | target_vars: List[str] = [] |
| 298 | if target_variable2 == 'hr': |
| 299 | return [constants.SURFACE_FLUXES, constants.TOA_FLUXES, constants.HEATING_RATES] |
| 300 | else: |
| 301 | if 'flux' in target_variable2: |
| 302 | target_vars += [constants.FLUXES] |
| 303 | if 'hr' in target_variable2: |
| 304 | target_vars += [constants.HEATING_RATES] |
| 305 | |
| 306 | if len(target_vars) == 0: |
| 307 | raise ValueError(f"Target var `{target_variable2}` must be one of fluxes, heating_rate.") |
| 308 | return target_vars |
| 309 | |
| 310 | |
| 311 | def pressure_from_level_array(levels_array): |
nothing calls this directly
no outgoing calls
no test coverage detected