Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
finam
Manage
Activity
Members
Labels
Plan
Issues
31
Issue boards
Milestones
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FINAM
finam
Commits
eac06737
Commit
eac06737
authored
2 years ago
by
Martin Lange
Browse files
Options
Downloads
Patches
Plain Diff
fix units not found bug when using cf convention with ~ formatting
parent
2fef2f23
No related branches found
No related tags found
1 merge request
!103
Bugfix: Short CF units not found in registry when printing
Pipeline
#122428
passed with stages
Stage: test
Stage: build
in 2 minutes and 56 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/finam/data/tools.py
+5
-3
5 additions, 3 deletions
src/finam/data/tools.py
with
5 additions
and
3 deletions
src/finam/data/tools.py
+
5
−
3
View file @
eac06737
...
...
@@ -21,9 +21,8 @@ from .grid_tools import Grid, GridBase
# set default format to cf-convention for pint.dequantify
# some problems with degree_Celsius and similar here
pint_xarray
.
unit_registry
.
default_format
=
"
~cf
"
UNITS
=
pint_xarray
.
unit_registry
UNITS
.
default_format
=
"
cf
"
class
FinamDataError
(
Exception
):
...
...
@@ -422,7 +421,10 @@ def check(xdata, name, info, time=None, ignore_time=False, overwrite_name=False)
)
# check units
if
"
units
"
in
info
.
meta
and
UNITS
.
Unit
(
info
.
units
)
!=
get_units
(
xdata
):
raise
FinamDataError
(
"
check: given data has wrong units.
"
)
raise
FinamDataError
(
f
"
check: given data has wrong units.
"
f
"
Got
{
get_units
(
xdata
)
}
, expected
{
UNITS
.
Unit
(
info
.
units
)
}
.
"
)
def
_check_shape
(
xdata
,
grid
,
with_time
):
...
...
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