Skip to content

Commit

Permalink
Read dimensions other than variable and region from external repo (
Browse files Browse the repository at this point in the history
  • Loading branch information
korsbakken authored Oct 17, 2024
1 parent 829844a commit 7913ff1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nomenclature/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ class DataStructureConfig(BaseModel):
"""

model: Optional[CodeListConfig] = Field(default_factory=CodeListConfig)
scenario: Optional[CodeListConfig] = Field(default_factory=CodeListConfig)
region: Optional[RegionCodeListConfig] = Field(default_factory=RegionCodeListConfig)
variable: Optional[CodeListConfig] = Field(default_factory=CodeListConfig)

@field_validator("region", "variable", mode="before")
@field_validator("model", "scenario", "region", "variable", mode="before")
@classmethod
def add_dimension(cls, v, info: ValidationInfo):
return {"dimension": info.field_name, **v}
Expand All @@ -134,7 +136,7 @@ def add_dimension(cls, v, info: ValidationInfo):
def repos(self) -> dict[str, str]:
return {
dimension: getattr(self, dimension).repositories
for dimension in ("region", "variable")
for dimension in ("model", "scenario", "region", "variable")
if getattr(self, dimension).repositories
}

Expand Down

0 comments on commit 7913ff1

Please sign in to comment.