-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #134 merge partitions with inconsistent grids amongst partitions #216
Conversation
* Add ``max_face_node_dimension`` property for Ugrid2D * Add ``max_connectivity_dimensions`` property
* Add function to maybe pad connectivity max dims * Group data objects and other vars by gridname
…are added to merged
Tested with both examples from #134 and #86 and they both work. However, I do notice odd behaviour. When using import glob
import xugrid as xu
import datetime as dt
file_nc = r'p:\1230882-emodnet_hrsm\GTSMv5.0\SO_NHrivGTSM\computations\BD014_fix_mapformat4\output\gtsm_model_0*_map.nc'
file_nc_list = glob.glob(file_nc)
partitions = []
for iF, file_nc_one in enumerate(file_nc_list):
uds_part = xu.open_mfdataset(file_nc_one)
partitions.append(uds_part)
dtstart = dt.datetime.now()
uds = xu.merge_partitions(partitions)
print(f'merging took: {(dt.datetime.now()-dtstart).total_seconds():.2f} sec') Using xarray 2023.11.0 |
I guess you can also try loading the datasets with just Is there maybe a difference between the eagerness? If you call |
@Huite, thanks for your suggestions. Indeed, the combination of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this. There seemed to bee some issues, but input from @Huite I think we can conclude this PR works like a charm.
docs/changelog.rst
Outdated
|
||
Changed | ||
~~~~~~~ | ||
|
||
- :meth:`xugrid.Ugrid2d.from_structured` now takes ``x`` and ``y`` arguments instead | ||
of ``x_bounds`` and ``y_bounds`` arguments. | ||
- :func:`xugrid.merge_partitions` allows merging partitions with different grids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, this is added under fixed and changed? Maybe just mention it only for "fixed"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit in doubt:
I added it to changed, because it is a change of behavior: Prior to this changeset, we test explicitly if all grids occur in every partitions and throw a error if this is not the case. Therefore this changeset doesn't really "fix" a bug, it alters behavior.
On the other hand, the changeset brings xugrid closer to supporting UGRID conventions, so if the premise of xugrid is to support every UGRID file (at least: those without mistakes), you can argue this is a "fix".
For now, I just kept the text under "changed".
…the former method return a tuple of names instead
Great job! |
Fix #134 and #86,
Add support for merging partitions with different grids in each partition, for example 1D grid in one partition and 2D grids in each. Quite some refactoring was required: