Skip to content

write_grid #1192

Answered by vgalligani
vgalligani asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, so the grid written has the right dimensions, the problem was actually in the read_grid(name)

in the lines where

if field_dic['data'].shape == field_shape_with_time:
field_dic['data'].shape = field_shape
fields[field] = field_dic
else:
bad_shape = field_dic['data'].shape
warnings.warn(
'Field %s skipped due to incorrect shape %s'
% (field, bad_shape))

with the following for the Zh in my grid:
field_shape_with_time = (1, 1, 720, 781)
field_dic[data].shape = (720, 1, 720, 781)

so I replaced
field_shape = tuple([len(dset.dimensions[d]) for d in [,'z', 'y', 'x']])
field_shape_with_time = (1, ) + field_shape

with
field_shape = tuple([len(dset.dimensions[d]) for d in ['time','z', 'y', 'x']])

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mgrover1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #996 on June 30, 2022 19:16.