Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
toargridding
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
toar-public
toargridding
Commits
da1f4398
Commit
da1f4398
authored
2 months ago
by
Carsten Hinz
Browse files
Options
Downloads
Patches
Plain Diff
added option to get variable from ID instead of name or cf_standard_name
parent
9aa0c60b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/toargridding/static_metadata.py
+20
-0
20 additions, 0 deletions
src/toargridding/static_metadata.py
with
20 additions
and
0 deletions
src/toargridding/static_metadata.py
+
20
−
0
View file @
da1f4398
...
...
@@ -112,6 +112,26 @@ class TOARVariable:
return
var
msg
=
f
"
TOAR Database contains no variable
{
name
}
"
raise
ValueError
(
msg
)
@classmethod
def
get_from_id
(
cls
,
id
:
int
)
->
"
TOARVariable
"
:
"""
searches the known variables for the given id
Parameters:
----------
id:
id of the variable according to the TOAR database config
return:
provides direct access to the meta data of the selected variable
"""
if
id
==
None
:
raise
ValueError
(
"
No id provided for variable.
"
)
for
var
in
cls
.
vars
:
if
var
.
id
==
id
:
return
var
msg
=
f
"
TOAR Database contains no variable with id
{
id
}
"
raise
ValueError
(
msg
)
@property
def
toar_id
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment