Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coyote
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nils
coyote
Commits
4160449a
Commit
4160449a
authored
2 months ago
by
Siddhant Tibrewal
Browse files
Options
Downloads
Patches
Plain Diff
fixed the right value to be passed for chunk-shape in zarr 3
parent
3403df03
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!43
Draft: Resolve "Migrate to Zarr3 and add example for a dataset using sharding"
Pipeline
#98438
waiting for manual action
Stage: lint
Stage: build
Stage: test
Stage: verify
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/hiopy/configure/configure.py
+7
-5
7 additions, 5 deletions
apps/hiopy/configure/configure.py
apps/hiopy/configure/create_dataset.py
+13
-15
13 additions, 15 deletions
apps/hiopy/configure/create_dataset.py
requirements-dev.txt
+1
-1
1 addition, 1 deletion
requirements-dev.txt
with
21 additions
and
21 deletions
apps/hiopy/configure/configure.py
+
7
−
5
View file @
4160449a
...
...
@@ -75,18 +75,20 @@ def add_variable(
if
zaxis
is
None
:
shape
=
(
*
ntime
,
crs_len
)
_chunk_shape
=
(
np
.
min
(
chunk_shape
,
shape
),)
if
chunk_shape
is
not
None
else
None
_attributes
[
"
_ARRAY_DIMENSIONS
"
]
=
(
*
taxis_tuple
,
spatial_attr
)
else
:
nheight
=
g
.
get
(
zaxis
).
shape
[
0
]
shape
=
(
*
ntime
,
nheight
,
crs_len
)
_chunk_shape
=
(
np
.
min
(
chunk_shape
,
shape
),)
if
chunk_shape
is
not
None
else
None
_attributes
[
"
_ARRAY_DIMENSIONS
"
]
=
(
*
taxis_tuple
,
zaxis
,
spatial_attr
)
_attributes
[
"
grid_mapping
"
]
=
"
crs
"
_attributes
[
"
grid_mapping
"
]
=
"
crs
"
_chunk_shape
=
"
auto
"
_shard_shape
=
None
if
chunks_per_shard
is
not
None
:
_shard_shape
=
tuple
(
i
*
chunks_per_shard
for
i
in
_chunk_shape
)
if
chunk_shape
is
not
None
:
_chunk_shape
=
(
np
.
min
(
chunk_shape
,
shape
),)
if
chunks_per_shard
is
not
None
:
_shard_shape
=
tuple
(
i
*
chunks_per_shard
for
i
in
_chunk_shape
)
v
=
g
.
create_array
(
name
,
...
...
This diff is collapsed.
Click to expand it.
apps/hiopy/configure/create_dataset.py
+
13
−
15
View file @
4160449a
...
...
@@ -5,7 +5,7 @@ import zarr
def
add_coordinates
(
dataset
:
zarr
.
Dataset
,
dataset
:
zarr
.
Group
,
coordinates
:
list
[
tuple
[
float
,
float
]],
coord_names
:
tuple
[
str
,
str
]
=
(
"
lon
"
,
"
lat
"
),
)
->
None
:
...
...
@@ -14,8 +14,8 @@ def add_coordinates(
Parameters
----------
dataset : zarr.
Dataset
The Zarr
dataset
where the coordinates will be added.
dataset : zarr.
Group
The Zarr
group
where the coordinates will be added.
coordinates : list[tuple[float, float]]
A list of tuples containing the (longitude, latitude) values for each point.
coord_names : tuple[str, str], optional
...
...
@@ -35,33 +35,31 @@ def add_coordinates(
lat_list
,
lon_list
=
zip
(
*
coordinates
)
lon
=
dataset
.
create_
array
(
name
=
coord_names
[
0
],
fill_value
=
None
,
shape
=
lon_list
.
shape
,
dtype
=
np
.
float32
lon
=
dataset
.
create_
dataset
(
name
=
coord_names
[
0
],
data
=
np
.
array
(
lon_list
),
shape
=
(
len
(
coordinates
),)
)
lon
[:]
=
np
.
array
(
lon_list
)
lon
.
attrs
[
"
_ARRAY_DIMENSIONS
"
]
=
[
coord_names
[
0
]]
lon
.
attrs
[
"
long_name
"
]
=
"
longitude
"
lon
.
attrs
[
"
units
"
]
=
"
degree
"
lon
.
attrs
[
"
standard_name
"
]
=
"
grid_longitude
"
lat
=
dataset
.
create_
array
(
name
=
coord_names
[
1
],
fill_value
=
None
,
shape
=
lat_list
.
shape
,
dtype
=
np
.
float32
lat
=
dataset
.
create_
dataset
(
name
=
coord_names
[
1
],
data
=
np
.
array
(
lat_list
),
shape
=
(
len
(
coordinates
),)
)
lat
[:]
=
np
.
array
(
lat_list
)
lat
.
attrs
[
"
_ARRAY_DIMENSIONS
"
]
=
[
coord_names
[
1
]]
lat
.
attrs
[
"
long_name
"
]
=
"
latitude
"
lat
.
attrs
[
"
units
"
]
=
"
degree
"
lat
.
attrs
[
"
standard_name
"
]
=
"
grid_latitude
"
def
add_healpix_grid
(
dataset
:
zarr
.
Dataset
,
order
:
int
):
def
add_healpix_grid
(
dataset
:
zarr
.
Group
,
order
:
int
):
"""
Add a HealPix grid to the specified Zarr dataset.
Parameters
----------
dataset : zarr.
Dataset
The Zarr
dataset
where the HealPix grid will be added to the crs.
dataset : zarr.
Group
The Zarr
group
where the HealPix grid will be added to the crs.
order : int
The order of the HealPix grid. This corresponds to 2^order for the NSIDE.
...
...
@@ -78,7 +76,7 @@ def add_healpix_grid(dataset: zarr.Dataset, order: int):
def
add_healpix_hierarchy
(
dataset
:
zarr
.
Dataset
,
dataset
:
zarr
.
Group
,
order
:
int
,
nr_of_coarsenings
:
int
=
4
,
prefix
:
str
=
"
healpix_
"
,
...
...
@@ -91,8 +89,8 @@ def add_healpix_hierarchy(
Parameters
----------
dataset : zarr.
Dataset
The Zarr
dataset
where the hierarchy will be added.
dataset : zarr.
Group
The Zarr
group
where the hierarchy will be added.
order : int
The maximum level in the hierarchy.
nr_of_coarsenings : int
...
...
This diff is collapsed.
Click to expand it.
requirements-dev.txt
+
1
−
1
View file @
4160449a
...
...
@@ -5,4 +5,4 @@ pre-commit
healpy
zarr>=3
aiohttp
rich
\ No newline at end of file
rich
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