cooling_heating_workflow_manager
¶
Classes:
CoolingHeatingWorkflowManager
¶
CoolingHeatingWorkflowManager(placements)
Bases: WorkflowManager
__init_(self, placements)
Initialization of an instance of the generic CoolingHeatingWorkflowManager class.
Parameters:
-
(placements¶pandas Dataframe) –The locations that the simulation should be run for. Columns must include "lon", "lat" (CRS: 4326) and "capacity" -The capacity is the nominal capacity of the Heating/Cooling System
Returns:
-
CoolingHeatingWorkflowManager– -
Sources– -
[1] https://www.engineeringtoolbox.com/air-density-specific-weight-d_600.html– -
[2] https://www.engineeringtoolbox.com/air-specific-heat-capacity-d_705.html–
Methods:
-
adjust_variable_to_long_run_average–Adjusts the average mean of the specified variable to a known long-run-average
-
apply_loss_factor–Applies a loss factor onto a specified variable
-
calculate_approach_evaporative_cooling–Calculate the approach temperature for an evaporative-cooling system.
-
calculate_capacity_factor_air_cooling–Calculate the capacity factor of an air-cooling system.
-
calculate_fan_power_air_cooling–Calculate the fan power demand for an air-cooling system.
-
calculate_pump_power_air_cooling–Calculate the pump power demand for an air-cooling system.
-
calculate_relative_cost_factor_air_cooling–Calculate the relative (air temperature dependent) cost factor of an air-cooling system.
-
calculate_water_losses_evaporative_cooling–Calculate the water losses for an evaporative-cooling system.
-
extract_raster_values_at_placements–Extracts pixel values at each of the configured placements from the specified raster file
-
get_scalar_values_from_raster–Auxiliary function to extract raster values with NaN fallback options.
-
read–Reads the specified variables from the NetCDF4-style weather dataset, and then extracts
-
register_workflow_parameter–Add a parameter to the WorkflowManager which will be included in the output XArray dataset
-
set_time_index–Sets the time index of the WorkflowManager
-
simulate_air_source_heat_pump–Simulate an air-source heat pump and calculate its coefficient of performance (COP) and conversion factors.
-
spatial_disaggregation–[summary]
-
to_netcdf–Saves an XArray dataset to netCDF4 format
-
to_xarray–Generates an XArray dataset from the data currently contained in the WorkflowManager
Source code in reskit/cooling_heating/workflows/cooling_heating_workflow_manager.py
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 | |
adjust_variable_to_long_run_average
¶
adjust_variable_to_long_run_average(
variable: str,
source_long_run_average: Union[str, float, ndarray],
real_long_run_average: Union[str, float, ndarray],
real_lra_scaling: float = 1,
spatial_interpolation: str = "linear-spline",
nodata_fallback: str = "nan",
nodata_fallback_scaling: float = 1,
allow_nans: bool = True,
)
Adjusts the average mean of the specified variable to a known long-run-average
Note:
uses the equation: variable[t] = variable[t] * real_long_run_average / source_long_run_average
Parameters:
-
(variable¶str) –The variable to be adjusted
-
(source_long_run_average¶Union[str, float, ndarray]) –The variable's native long run average (the average in the weather file) - If a string is given, it is expected to be a path to a raster file which can be used to look up the average values from using the coordinates in
.placements- If a numpy ndarray (or derivative) is given, the shape must be one of (time, placements) or at least (placements) -
(real_long_run_average¶Union[str, float, ndarray]) –The variables 'true' long run average - If a string is given, it is expected to be a path to a raster file which can be used to look up the average values from using the coordinates in
.placements- If a numpy ndarray (or derivative) is given, the shape must be one of (time, placements) or at least (placements) -
(real_lra_scaling¶float, default:1) –An optional scaling factor to apply to the values derived from
real_long_run_average. - This is primarily useful whenreal_long_run_averageis a path to a raster file - By default 1 -
(spatial_interpolation¶str, default:'linear-spline') –When either
source_long_run_averageorreal_long_run_averageare a path to a raster file, this input specifies which interpolation algorithm should be used - Options are: "near", "linear-spline", "cubic-spline", "average" - By default "linear-spline" - See for more info: geokit.raster.interpolateValues -
(nodata_fallback¶str, default:'nan') –When real_long_run_average has no data, one can decide between different fallback options, by default np.nan: - np.nan or None : return np.nan for missing values in real_long_run_average - float : Apply this float value as a scaling factor for all no-data locations only: source_long_run_average * nodata_fallback. NOTE: A value of 1.0 will return the source lra value in case of missing real lra values (no additional nodata_fallback_scaling applied). - str : Will be interpreted as a filepath to a raster with alternative real_long_run_average values, scaled by nodata_fallback_scaling. - callable : any callable method taking the arguments (all iterables): 'locs' and 'source_long_run_average_value' (the locations as gk.geom.point objects and original value from source data). The output values will be considered as the new real_long_run_average for missing locations only (absolute data, no additional nodata_fallback_scaling applied).
NOTE: np.nan will also be returned in case that the nodata fallback does not yield values either.
-
(nodata_fallback_scaling¶float, default:1) –An optional scaling factor to apply to the values derived from
nodata_fallback. - This is primarily useful whennodata_fallbackis a path to a raster file - By default 1 -
(allow_nans¶boolean, default:True) –If True, NaN values may remain after scaling, else an error will raised. By default True.
Returns:
-
WorkflowManager–Returns the invoking WorkflowManager (for chaining)
Source code in reskit/workflow_manager.py
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 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
apply_loss_factor
¶
apply_loss_factor(
loss: Union[float, ndarray, FunctionType],
variables: Union[str, List[str]] = ["capacity_factor"],
)
Applies a loss factor onto a specified variable
Parameters:
-
(loss¶Union[float, ndarray, FunctionType]) –The loss factor(s) to be applied - If a float or a numpy ndarray is given, then the following operation is performed:
variable = variable * (1 - loss) - If a function is given, then the following operation is performed: variable = variable * (1 - loss(variable) ) - If a numpy ndarray is given, it must be broadcastable to the variable's shape in
.sim_data -
(variables¶Union[str, List[str]], default:['capacity_factor']) –The variable or variables to apply the loss factor to - By default ["capacity_factor"]
Returns:
-
WorkflowManager–Returns the invoking WorkflowManager (for chaining)
Source code in reskit/workflow_manager.py
calculate_approach_evaporative_cooling
¶
calculate_approach_evaporative_cooling(
temperatureCoolant: float | int,
heatTransferDelta: float | int,
efficiencyCoolingTower: float | int,
)
Calculate the approach temperature for an evaporative-cooling system.
Parameters:
-
(temperatureCoolant¶float | int) –Temperature of the cooling load (lower temperature if sensible heat transfer) in °C.
-
(heatTransferDelta¶float | int) –Temperature difference required for heat transfer from air to coolant [K]
-
(efficiencyCoolingTower¶float | int) –Efficiency of the cooling tower system [0, 1]
Returns:
-
float or ndarray–Approach temperature for the specified weather conditions.
References
[1] 10.1016/j.ijhydene.2024.11.381
Source code in reskit/cooling_heating/workflows/cooling_heating_workflow_manager.py
calculate_capacity_factor_air_cooling
¶
calculate_capacity_factor_air_cooling(
designTemperature: float | int,
temperatureCoolant: float | int,
heatTransferDelta: float | int = 5,
efficiencyFan: float | int = 0.7,
efficiencyPump: float | int = 0.7,
pressureDropAir: float | int = 261,
pressureDropWater: float | int = 200000,
)
Calculate the capacity factor of an air-cooling system.
The air-cooling system can only provide the cooling load if the ambient air temperature is lower than the design temperature. If the temperature is above the design temperature, pumps and fans are designed too small to provide the necessary flows and the system can only provide less cooling. The reduction in cooling can be calculated based on the ratio of the design power and the theoretically required power for both, fans and pumps individually. The minimum of these ratios is the capacity factor. If the temperature rises above the coolant temperature minus the heat transfer delta, the system needs to shut off.
Parameters:
-
(designTemperature¶float | int) –Design ambient temperature of the cooling system [°C].
-
(temperatureCoolant¶float | int) –Temperature of the cooling load (lower temperature if sensible heat transfer) [°C].
-
(heatTransferDelta¶float | int, default:5) –Temperature difference required for heat transfer from air to coolant [K]. Default is 5.
-
(efficiencyFan¶float | int, default:0.7) –Efficiency of the fan system [0, 1]. Default is 0.7.
-
(efficiencyPump¶float | int, default:0.7) –Efficiency of the pump system [0, 1]. Default is 0.7.
-
(pressureDropAir¶float | int, default:261) –Pressure drop of air through the channels of the cooling frame [Pa]. Default is 261.
-
(pressureDropWater¶float | int, default:200000) –Pressure drop of the water circuit from the heat load to the A-frame [Pa]. Default is 200000.
Returns:
-
None–The method stores the calculated capacity factor in `self.sim_data["capacity_factor"]'.
Source code in reskit/cooling_heating/workflows/cooling_heating_workflow_manager.py
calculate_fan_power_air_cooling
¶
calculate_fan_power_air_cooling(
temperatureCoolant: float | int,
heatTransferDelta: float | int = 5,
efficiencyFan: float | int = 0.7,
pressureDropAir: float | int = 261,
designTemperature: float | int = None,
)
Calculate the fan power demand for an air-cooling system.
This method computes the electrical power required by the fan to transfer heat
from the air to a coolant, based on the air properties and the cooling load
temperature. It can evaluate either for a given design air temperature or for
the time series of ambient air temperatures stored in self.sim_data.
Parameters:
-
(temperatureCoolant¶float | int) –Temperature of the cooling load (lower temperature if sensible heat transfer) in °C.
-
(heatTransferDelta¶float | int, default:5) –Temperature difference required for heat transfer from air to coolant [K]. Default is 5.
-
(efficiencyFan¶float | int, default:0.7) –Efficiency of the fan system [0, 1]. Default is 0.7.
-
(pressureDropAir¶float | int, default:261) –Pressure drop of air through the channels of the cooling frame [Pa]. Default is 261.
-
(designTemperature¶float | int, default:None) –If specified, the calculation is only evaluated at this air temperature [°C]. Default is None.
Returns:
-
float or ndarray–Fan power demand in kWh per kWh of cooling. Returns a single value if
designTemperatureis provided, or a time series array otherwise.
Notes
- Uses linear interpolation of air specific heat (
cp) and density (rho) fromself.airData. - Assigns
np.infto any time step where the temperature difference is insufficient for cooling. - Stores the time series result in
self.sim_data["conversion_factor_fan_electricity"]ifdesignTemperatureis None.
References
[1] 10.1016/j.ijhydene.2024.11.381 [2] http://hdl.handle.net/1853/55674
Source code in reskit/cooling_heating/workflows/cooling_heating_workflow_manager.py
calculate_pump_power_air_cooling
¶
calculate_pump_power_air_cooling(
temperatureCoolant: float | int,
heatTransferDelta: float | int = 5,
efficiencyPump: float | int = 0.7,
pressureDropWater: float | int = 200000,
designTemperature: float | int = None,
)
Calculate the pump power demand for an air-cooling system.
This method computes the electrical power required by the pump to circulate
coolant for an air-cooling system, based on the cooling load temperature,
pressure drop, and pump efficiency. It can evaluate either for a given design
air temperature or for the time series of ambient air temperatures stored in
self.sim_data.
Parameters:
-
(temperatureCoolant¶float | int) –Temperature of the cooling load (lower temperature if sensible heat transfer) in °C.
-
(heatTransferDelta¶float | int, default:5) –Temperature difference required for heat transfer from air to coolant [K]. Default is 5.
-
(efficiencyPump¶float | int, default:0.7) –Efficiency of the pump system [0, 1]. Default is 0.7.
-
(pressureDropWater¶float | int, default:200000) –Pressure drop of the water circuit between the heat load and the cooling frame [Pa]. Default is 200000.
-
(designTemperature¶float | int, default:None) –If specified, the calculation is only evaluated at this air temperature [°C]. Default is None.
Returns:
-
float or ndarray– -
Pump power demand in kWh per kWh of cooling. Returns a single value if– -
`designTemperature` is provided, or a time series array otherwise.–
Notes
- Assumes constant water density of 1000 kg/m³ and specific heat capacity of 4.186 kJ/(kg·K) = 0.00116 kWh/(kg·K).
- Assigns
np.infto any time step where the temperature difference is insufficient for cooling. - Stores the time series result in
self.sim_data["conversion_factor_pump_electricity"]ifdesignTemperatureis None.
References
[1] 10.1016/j.ijhydene.2024.11.381 [2] 10.1016/j.enconman.2020.113610
Source code in reskit/cooling_heating/workflows/cooling_heating_workflow_manager.py
calculate_relative_cost_factor_air_cooling
¶
calculate_relative_cost_factor_air_cooling(
designTemperature: float | int,
temperatureCoolant: float | int,
heatTransferDelta: float | int = 5,
efficiencyFan: float | int = 0.7,
efficiencyPump: float | int = 0.7,
pressureDropAir: float | int = 261,
pressureDropWater: float | int = 200000,
)
Calculate the relative (air temperature dependent) cost factor of an air-cooling system.
The air-cooling system consists of fans, water pumps, and an A-frame heat exchanger
that transfers heat from water to air. The A-frame is assumed to always transfer
heat with the specified heatTransferDelta. Fan and pump costs depend on the
installed nominal power, which varies with ambient air temperature. The relative cost
factor is defined as the ratio of cost at the design temperature to the cost at
actual ambient temperatures. To cool the same amount of heat at an air temperature higher than the design air temperature, the CAPEX would rise, since pump and fan capacity would increase.
Parameters:
-
(designTemperature¶float | int) –Design ambient temperature of the cooling system [°C].
-
(temperatureCoolant¶float | int) –Temperature of the cooling load (lower temperature if sensible heat transfer) [°C].
-
(heatTransferDelta¶float | int, default:5) –Temperature difference required for heat transfer from air to coolant [K]. Default is 5.
-
(efficiencyFan¶float | int, default:0.7) –Efficiency of the fan system [0, 1]. Default is 0.7.
-
(efficiencyPump¶float | int, default:0.7) –Efficiency of the pump system [0, 1]. Default is 0.7.
-
(pressureDropAir¶float | int, default:261) –Pressure drop of air through the channels of the cooling frame [Pa]. Default is 261.
-
(pressureDropWater¶float | int, default:200000) –Pressure drop of the water circuit from the heat load to the A-frame [Pa]. Default is 200000.
Returns:
-
None– -
The method stores the calculated relative cost factor in `self.sim_data["relative_cost_factor"]`– -
and updates the `self.units` dictionary with air-cooling system units.–
Notes
- Fan and pump CAPEX are calculated based on nominal power at the design temperature and scaled according to ambient conditions [1].
- A-frame cost is assumed constant and independent of ambient temperature [2].
- The relative cost factor reflects the relative increase in cost at varying ambient conditions compared to the design point.
References
[1] 10.1016/j.energy.2015.05.081 [2] 10.1016/j.enconman.2020.113610
Source code in reskit/cooling_heating/workflows/cooling_heating_workflow_manager.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 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 490 491 492 493 494 495 496 497 498 | |
calculate_water_losses_evaporative_cooling
¶
calculate_water_losses_evaporative_cooling(
temperatureCoolant: float | int,
heatTransferDelta: float | int,
efficiencyCoolingTower: float | int,
factorDriftLosses: float | int = 0.001,
typical_cycles_blowdown: int = 5,
)
Calculate the water losses for an evaporative-cooling system.
Parameters:
-
(temperatureCoolant¶float | int) –Temperature of the cooling load (lower temperature if sensible heat transfer) in °C.
-
(heatTransferDelta¶float | int) –Temperature difference required for heat transfer from air to coolant [K]
-
(efficiencyCoolingTower¶float | int) –Efficiency of the cooling tower system [0, 1]
-
(factorDriftLosses¶float | int, default:0.001) –Drift losses by small water droplets carried away by the exhaust air. Defaults to 0.001. [1]
-
(typical_cycles_blowdown¶int, default:5) –after how many cycles the blowdown occurs to prevent accumulation of impurities. Defaults to 5. [2]
Returns:
-
float or ndarray–Specific water losses of evaporative cooling towers (per kWh of cooling load) for the specified weather conditions.
References
[1] 10.1016/j.ijhydene.2024.11.381 [2] 10.1016/j.enconman.2020.113610
Source code in reskit/cooling_heating/workflows/cooling_heating_workflow_manager.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 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 | |
extract_raster_values_at_placements
¶
Extracts pixel values at each of the configured placements from the specified raster file
get_scalar_values_from_raster
¶
Auxiliary function to extract raster values with NaN fallback options.
Source code in reskit/workflow_manager.py
read
¶
read(
variables: Union[str, List[str]],
source_type: str,
source: str,
set_time_index: bool = False,
spatial_interpolation_mode: str = "bilinear",
temporal_reindex_method: str = "nearest",
time_index_from=None,
**kwargs,
)
Reads the specified variables from the NetCDF4-style weather dataset, and then extracts
those variables for each of the coordinates configured in .placements. The resulting
data is then available in .sim_data.
Parameters:
-
(variables¶str or list of strings) –The variables (or variables) to be read from the specified source - If a path to a weather source is given, then only the 'standard' variables configured for that source type are available (see the doc string for the weather source you are interested in) - If either 'elevated_wind_speed' or 'surface_wind_speed' is included in the variable list, then the members
.elevated_wind_speed_heightand.surface_wind_speed_height, respectfully, are also added. These are constants which specify what the 'native' wind speed height is, which depends on the source - A pre-loaded NCSource can also be given, thus allowing for any variable in the source to be specified in thevariableslist. But the user needs to take care of initializing the NCSource and loading the data they want -
(source_type¶str) –The type of weather datasource which is to be loaded. Can be one of: "ERA5", "SARAH", "MERRA", or 'user' - If a pre-loaded NCSource is given for the
sourceobject, then thesource_typeshould be "user" -
(source¶str or NCSource) –The source to read weather variables from
-
(set_time_index¶bool, default:False) –If True, instructs the workflow manager to set the time index to that which is read from the weather source - By default False
-
(spatial_interpolation_mode¶str, default:'bilinear') –The spatial interpolation mode to use while reading data from the weather source at each of the placement coordinates - By default "bilinear"
-
(temporal_reindex_method¶str, default:'nearest') –In the event of missing data, this algorithm is used to fill in the missing data. - Can be, for example, "nearest", "ffill", "bfill", "interpolate" - By default "nearest"
Returns:
-
WorkflowManager–Returns the invoking WorkflowManager (for chaining)
Raises:
-
RuntimeError–If set_time_index is False but no
.time_indexexists -
RuntimeError–If source_type is unknown
Source code in reskit/workflow_manager.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 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 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
register_workflow_parameter
¶
Add a parameter to the WorkflowManager which will be included in the output XArray dataset
Parameters:
-
(key¶str) –The workflow parameter's access key
-
(value¶Union[str, float]) –The workflow parameter's value. Only strings and floats are allowed
Source code in reskit/workflow_manager.py
set_time_index
¶
Sets the time index of the WorkflowManager
Source code in reskit/workflow_manager.py
simulate_air_source_heat_pump
¶
simulate_air_source_heat_pump(
targetTemperature: float | int = 100,
secondLawEfficiency: float | int = 0.5,
)
Simulate an air-source heat pump and calculate its coefficient of performance (COP) and conversion factors.
The method computes the COP based on the ambient air temperature and the target supply temperature of the heat pump. It also calculates the electricity conversion factor per unit of thermal energy delivered.
Parameters:
-
(targetTemperature¶float | int, default:100) –Target temperature at which the heat should be supplied [°C]. Default is 100.
-
(secondLawEfficiency¶float | int, default:0.5) –Second law efficiency of the heat pump [0,1]. Default is 0.5.
Returns:
-
None–The calculated COP and conversion factors are stored in
self.sim_data. Theself.unitsdictionary is also updated to reflect the units of the heat pump.
Notes
- The electricity conversion factor is calculated as -1/COP [kWh_el/kWh_th].
- Units set include thermal capacity (
kW_th), electricity conversion factor (kWh_el/kWh_th), and electricity input (kWh_el).
Source code in reskit/cooling_heating/workflows/cooling_heating_workflow_manager.py
spatial_disaggregation
¶
spatial_disaggregation(
variable: str,
source_high_resolution: Union[str, float, ndarray],
source_low_resolution: Union[str, float, ndarray],
real_lra_scaling: float = 1,
spatial_interpolation: str = "linear-spline",
)
[summary]
Parameters:
-
(variable¶str) –[description]
-
(source_long_run_average¶Union[str, float, ndarray]) –[description]
-
(real_long_run_average¶Union[str, float, ndarray]) –[description]
-
(real_lra_scaling¶float, default:1) –[description], by default 1
-
(spatial_interpolation¶str, default:'linear-spline') –[description], by default "linear-spline"
Source code in reskit/workflow_manager.py
to_netcdf
¶
to_netcdf(
xds: Dataset,
output_netcdf_path: str = None,
output_variables: List[str] = None,
custom_attributes: dict = None,
_intermediate_dict=False,
) -> str
Saves an XArray dataset to netCDF4 format
Note:
- The .placements data is automatically added to the XArray dataset along the 'locations' dimension
- The workflow_parameters data is automatically added as dimensionless variables
- The .sim_data is automatically added along the dimensions (time, locations)
- The .time_index is automatically added along the dimension 'time'
Parameters:
-
(xds¶Dataset) –The XArray dataset to save
-
(output_netcdf_path¶str, default:None) –If given, the XArray dataset will be written to disc at the specified path - By default None
-
(output_variables¶List[str], default:None) –If given, specifies the variables which should be included in the resulting dataset. Otherwise all suitable variables found in
.placements,.workflow_parameters,.sim_data, and.time_indexwill be included - Only variables of numeric or string type are suitable due to NetCDF4 limitations - By default None -
(custom_attributes¶dict, default:None) –If given, adds the key-value pairs as attributes to the XArray dataset before saving - These will be added in addition to existing attributes - By default None
Returns:
-
output_netcdf_path–The resulting output_netcdf_path
Source code in reskit/workflow_manager.py
to_xarray
¶
to_xarray(
output_netcdf_path: str = None,
output_variables: List[str] = None,
custom_attributes: dict = None,
_intermediate_dict=False,
) -> Dataset
Generates an XArray dataset from the data currently contained in the WorkflowManager
Note:
- The .placements data is automatically added to the XArray dataset along the 'locations' dimension
- The workflow_parameters data is automatically added as dimensionless variables
- The .sim_data is automatically added along the dimensions (time, locations)
- The .time_index is automatically added along the dimension 'time'
Parameters:
-
(output_netcdf_path¶str, default:None) –If given, the XArray dataset will be written to disc at the specified path - By default None
-
(output_variables¶List[str], default:None) –If given, specifies the variables which should be included in the resulting dataset. Otherwise all suitable variables found in
.placements,.workflow_parameters,.sim_data, and.time_indexwill be included - Only variables of numeric or string type are suitable due to NetCDF4 limitations - By default None -
(custom_attributes¶dict, default:None) –If given, adds the key-value pairs as attributes to the XArray dataset - These will be added in addition to the workflow_parameters - By default None
Returns:
-
Dataset–The resulting XArray dataset
Source code in reskit/workflow_manager.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | |