-
Notifications
You must be signed in to change notification settings - Fork 139
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
"only length-1 arrays can be converted to Python scalars" error when setting periodic boundaries #1685
Comments
Looks like the problem is in the C-conversion code in |
After some investigation from @sruehs and @michaeldenes it looks to be a problem with the data and not Parcels |
From the periodic boundary conditions tutorial (https://docs.oceanparcels.org/en/latest/examples/tutorial_periodic_boundaries.html), the following lines are used to add the periodic halo: fieldset.add_constant("halo_west", fieldset.U.grid.lon[0])
fieldset.add_constant("halo_east", fieldset.U.grid.lon[-1])
fieldset.add_periodic_halo(zonal=True) The grid here is a print(fieldset.U.grid.lon.shape, fieldset.U.grid.lat.shape)
So, when creating the halos, However, in @sruehs case, the shape of underlying grids are not 1D-arrays, rather 2D-arrays. When adding the two constants In the past, using an Arakawa B-grid (and MOM5 data), I've used the exact same code to add the halo, so I'm not sure why it's not working here, unless the grid is weird... |
Lines 1352 to 1372 in 93cc635
What is the usecase for having I still am a bit concerned about the format of this data (ie., 'why is lon a 2D array?'), and how it compares against other datasets we've used. I can block out some time to look at this properly EDIT: I see now. Since its a curvilinear grid lon and lat aren't dimensions (more the dimensions are |
I don't think there is a use-case for I think parcels handles the periodicity in the nemo c-grids out of the box, but just to show as an example, if you load the data from the nemo tutorial (https://docs.oceanparcels.org/en/latest/examples/tutorial_nemo_3D.html), and print out the shapes of the grids: print(fieldset.U.grid.lon.shape, fieldset.U.grid.lat.shape) you get |
Parcels version
3.0.3
Description
I encountered an error when running Parcels with b-SOSE (MITgcm) fields on Lorenz, which I have not seen before. It seems to be linked to some kind of conversion? Any help how to approach this is appreciated!
Code sample
The text was updated successfully, but these errors were encountered: