Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
finam
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Code
Merge requests
4
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
0e87f9ec
Commit
0e87f9ec
authored
2 years ago
by
Martin Lange
Browse files
Options
Downloads
Patches
Plain Diff
cache data_size / calculate more efficiently
parent
29221381
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!237
Optimize units etc.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/finam/data/grid_spec.py
+17
-0
17 additions, 0 deletions
src/finam/data/grid_spec.py
with
17 additions
and
0 deletions
src/finam/data/grid_spec.py
+
17
−
0
View file @
0e87f9ec
...
...
@@ -84,6 +84,7 @@ class RectilinearGrid(StructuredGrid):
self
.
_crs
=
crs
self
.
_data_shape
=
None
self
.
_data_size
=
None
def
to_unstructured
(
self
):
"""
...
...
@@ -116,6 +117,13 @@ class RectilinearGrid(StructuredGrid):
self
.
_data_shape
=
super
().
data_shape
return
self
.
_data_shape
@property
def
data_size
(
self
):
"""
int: Size of the associated data.
"""
if
self
.
_data_size
is
None
:
self
.
_data_size
=
super
().
data_size
return
self
.
_data_size
@property
def
axes
(
self
):
"""
list of np.ndarray: Grid points.
"""
...
...
@@ -438,6 +446,15 @@ class UnstructuredGrid(Grid):
else
(
len
(
self
.
cells
),)
)
@property
def
data_size
(
self
):
"""
int: Size of the associated data.
"""
return
(
len
(
self
.
points
)
if
self
.
data_location
==
Location
.
POINTS
else
len
(
self
.
cells
)
)
@property
def
cells
(
self
):
"""
np.ndarray: Cell nodes in ESMF format.
"""
...
...
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