-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(project info): add schema for project information #382
Merged
mostaphaRoudsari
merged 2 commits into
ladybug-tools:master
from
mostaphaRoudsari:add-project-info
Jan 26, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
"""Schema for project information.""" | ||
from pydantic import BaseModel, Field, constr, AnyUrl | ||
from typing import List | ||
|
||
from .energy.simulation import EfficiencyStandards, ClimateZones, BuildingTypes | ||
|
||
|
||
class Location(BaseModel): | ||
"""A Ladybug Location.""" | ||
|
||
type: constr(regex='^Location$') = 'Location' | ||
|
||
city: str = Field( | ||
'-', | ||
description='Name of the city as a string.' | ||
) | ||
|
||
latitude: float = Field( | ||
0, | ||
description='Location latitude between -90 and 90 (Default: 0).' | ||
) | ||
|
||
longitude: float = Field( | ||
0, | ||
description='Location longitude between -180 (west) and 180 (east) (Default: 0).' | ||
) | ||
|
||
time_zone: float = Field( | ||
None, | ||
mostaphaRoudsari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description='Time zone between -12 hours (west) and +14 hours (east). ' | ||
'If None, the time zone will be an estimated integer value derived from ' | ||
'the longitude in accordance with solar time.' | ||
) | ||
|
||
elevation: float = Field( | ||
0, | ||
description='A number for elevation of the location in meters. (Default: 0).' | ||
) | ||
|
||
station_id: str = Field( | ||
None, | ||
mostaphaRoudsari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description='ID of the location if the location is representing a weather ' | ||
'station.' | ||
) | ||
|
||
source: str = Field( | ||
None, description='Source of data (e.g. TMY, TMY3).' | ||
mostaphaRoudsari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
|
||
|
||
class ProjectInfo(BaseModel): | ||
"""Project information.""" | ||
|
||
type: constr(regex='^ProjectInfo$') = 'ProjectInfo' | ||
|
||
north: float = Field( | ||
0, | ||
description='A number between -360 to 360 where positive values rotate the ' | ||
'compass counterclockwise (towards the West) and negative values rotate the ' | ||
'compass clockwise (towards the East).', | ||
le=360, ge=-360 | ||
) | ||
|
||
weather_urls: List[AnyUrl] = Field( | ||
None, | ||
description='A list of URLs to zip files that includes EPW, DDY and STAT files. ' | ||
'You can find these URLs from the EPWMAP. The first URL will be used as the ' | ||
'primary weather file.' | ||
) | ||
|
||
location: Location = Field( | ||
None, | ||
description='Project location. This value is usually generated from the ' | ||
'information in the weather files.' | ||
) | ||
|
||
ashrae_climate_zone: ClimateZones = Field( | ||
None, | ||
description='Project location climate zone.' | ||
) | ||
|
||
building_type: List[BuildingTypes] = Field( | ||
None, | ||
description='A list of building types for the project. The first building ' | ||
'type is considered the primary type for the project.' | ||
) | ||
|
||
vintage: List[EfficiencyStandards] = Field( | ||
None, | ||
description='A list of building vintages (e.g. ASHRAE_2019, ASHRAE_2016).' | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah crud. I should have caught this. I'm going to have to revert this line as it will break several workflows. This one needs to be a string.