Searching Instances: Search¶
We assume that you have generated a SDK for the WindTurbine
model and have a client ready to go.
pygen
automatically generates a search method for the text based properties in the views.
In [3]:
Copied!
from wind_turbine import WindTurbineClient
from wind_turbine import WindTurbineClient
In [4]:
Copied!
pygen = WindTurbineClient.from_toml("config.toml")
pygen = WindTurbineClient.from_toml("config.toml")
In [6]:
Copied!
result = pygen.wind_turbine.search("Hornsea")
result
result = pygen.wind_turbine.search("Hornsea")
result
Out[6]:
space | external_id | capacity | name | blades | datasheets | nacelle | rotor | windfarm | data_record | |
---|---|---|---|---|---|---|---|---|---|---|
0 | sp_wind | hornsea_1_mill_3 | 7.0 | hornsea_1_mill_3 | [hornsea_1_mill_3_blade_A, hornsea_1_mill_3_bl... | [windmill_schematics] | hornsea_1_mill_3_nacelle | hornsea_1_mill_3_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
1 | sp_wind | hornsea_1_mill_2 | 7.0 | hornsea_1_mill_2 | [hornsea_1_mill_2_blade_B, hornsea_1_mill_2_bl... | [windmill_schematics] | hornsea_1_mill_2_nacelle | hornsea_1_mill_2_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
2 | sp_wind | hornsea_1_mill_1 | 7.0 | hornsea_1_mill_1 | [hornsea_1_mill_1_blade_A, hornsea_1_mill_1_bl... | [windmill_schematics] | hornsea_1_mill_1_nacelle | hornsea_1_mill_1_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
3 | sp_wind | hornsea_1_mill_4 | 7.0 | hornsea_1_mill_4 | [hornsea_1_mill_4_blade_C, hornsea_1_mill_4_bl... | [windmill_schematics] | hornsea_1_mill_4_nacelle | hornsea_1_mill_4_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
4 | sp_wind | hornsea_1_mill_5 | 7.0 | hornsea_1_mill_5 | [hornsea_1_mill_5_blade_B, hornsea_1_mill_5_bl... | [windmill_schematics] | hornsea_1_mill_5_nacelle | hornsea_1_mill_5_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
In [7]:
Copied!
result[0]
result[0]
Out[7]:
value | |
---|---|
space | sp_wind |
external_id | hornsea_1_mill_3 |
data_record | {'version': 4, 'last_updated_time': 2024-11-16... |
node_type | None |
capacity | 7.0 |
description | None |
name | hornsea_1_mill_3 |
blades | [hornsea_1_mill_3_blade_A, hornsea_1_mill_3_bl... |
datasheets | [windmill_schematics] |
metmast | None |
nacelle | hornsea_1_mill_3_nacelle |
power_curve | None |
rotor | hornsea_1_mill_3_rotor |
windfarm | Hornsea 1 |
By default, search
checks all text fields in the underlying view, but we can also specify which properties to search
In [9]:
Copied!
result = pygen.wind_turbine.search("Hornsea", properties="windfarm")
result
result = pygen.wind_turbine.search("Hornsea", properties="windfarm")
result
Out[9]:
space | external_id | capacity | name | blades | datasheets | nacelle | rotor | windfarm | data_record | |
---|---|---|---|---|---|---|---|---|---|---|
0 | sp_wind | hornsea_1_mill_3 | 7.0 | hornsea_1_mill_3 | [hornsea_1_mill_3_blade_A, hornsea_1_mill_3_bl... | [windmill_schematics] | hornsea_1_mill_3_nacelle | hornsea_1_mill_3_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
1 | sp_wind | hornsea_1_mill_2 | 7.0 | hornsea_1_mill_2 | [hornsea_1_mill_2_blade_B, hornsea_1_mill_2_bl... | [windmill_schematics] | hornsea_1_mill_2_nacelle | hornsea_1_mill_2_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
2 | sp_wind | hornsea_1_mill_1 | 7.0 | hornsea_1_mill_1 | [hornsea_1_mill_1_blade_A, hornsea_1_mill_1_bl... | [windmill_schematics] | hornsea_1_mill_1_nacelle | hornsea_1_mill_1_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
3 | sp_wind | hornsea_1_mill_4 | 7.0 | hornsea_1_mill_4 | [hornsea_1_mill_4_blade_C, hornsea_1_mill_4_bl... | [windmill_schematics] | hornsea_1_mill_4_nacelle | hornsea_1_mill_4_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
4 | sp_wind | hornsea_1_mill_5 | 7.0 | hornsea_1_mill_5 | [hornsea_1_mill_5_blade_B, hornsea_1_mill_5_bl... | [windmill_schematics] | hornsea_1_mill_5_nacelle | hornsea_1_mill_5_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
The .search
methods has the same filtering options as the .list
method
In [10]:
Copied!
result = pygen.wind_turbine.search("Hornsea", min_capacity=6.0)
result
result = pygen.wind_turbine.search("Hornsea", min_capacity=6.0)
result
Out[10]:
space | external_id | capacity | name | blades | datasheets | nacelle | rotor | windfarm | data_record | |
---|---|---|---|---|---|---|---|---|---|---|
0 | sp_wind | hornsea_1_mill_3 | 7.0 | hornsea_1_mill_3 | [hornsea_1_mill_3_blade_A, hornsea_1_mill_3_bl... | [windmill_schematics] | hornsea_1_mill_3_nacelle | hornsea_1_mill_3_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
1 | sp_wind | hornsea_1_mill_2 | 7.0 | hornsea_1_mill_2 | [hornsea_1_mill_2_blade_B, hornsea_1_mill_2_bl... | [windmill_schematics] | hornsea_1_mill_2_nacelle | hornsea_1_mill_2_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
2 | sp_wind | hornsea_1_mill_1 | 7.0 | hornsea_1_mill_1 | [hornsea_1_mill_1_blade_A, hornsea_1_mill_1_bl... | [windmill_schematics] | hornsea_1_mill_1_nacelle | hornsea_1_mill_1_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
3 | sp_wind | hornsea_1_mill_4 | 7.0 | hornsea_1_mill_4 | [hornsea_1_mill_4_blade_C, hornsea_1_mill_4_bl... | [windmill_schematics] | hornsea_1_mill_4_nacelle | hornsea_1_mill_4_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
4 | sp_wind | hornsea_1_mill_5 | 7.0 | hornsea_1_mill_5 | [hornsea_1_mill_5_blade_B, hornsea_1_mill_5_bl... | [windmill_schematics] | hornsea_1_mill_5_nacelle | hornsea_1_mill_5_rotor | Hornsea 1 | {'version': 4, 'last_updated_time': 2024-11-16... |
Note that .search()
should be used for searching and not filtering. If you only want to filter use the .list()
method
Next section: Aggregation
In [ ]:
Copied!