Skip to content

Conversation

@erikvansebille
Copy link
Member

@erikvansebille erikvansebille commented Aug 29, 2024

Following #1612, where we need to provide the gridindexingtype on the CField struct for technical reasons, it makes sense to also use it throughout the rest of the C-code. Hence, this PR refactors the code to not require the gridindexingtype and interp_method when calling a Field evaluation in C, but get them from the CField itself

@erikvansebille erikvansebille changed the base branch from master to croco_3D_velocities August 29, 2024 07:28
@erikvansebille erikvansebille changed the base branch from croco_3D_velocities to analyticaladvection_in_jit August 29, 2024 07:29
@codecov
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files
@@                     Coverage Diff                     @@
##           analyticaladvection_in_jit    #1673   +/-   ##
===========================================================
  Coverage                       86.22%   86.22%           
===========================================================
  Files                              67       67           
  Lines                           11827    11828    +1     
===========================================================
+ Hits                            10198    10199    +1     
  Misses                           1629     1629           
Flag Coverage Δ
integration-tests 64.85% <100.00%> (+<0.01%) ⬆️
unit-tests 80.62% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
parcels/field.py 89.72% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines 1479 to +1491
gridindexingtype_mapping = {"nemo": 0, "mitgcm": 1, "mom5": 2, "pop": 3}
interp_method_mapping = {
"LINEAR": 0,
"NEAREST": 1,
"CGRID_VELOCITY": 2,
"CGRID_TRACER": 3,
"BGRID_VELOCITY": 4,
"BGRID_W_VELOCITY": 5,
"BGRID_TRACER": 6,
"LINEAR_INVDIST_LAND_TRACER": 7,
"PARTIALSLIP": 8,
"FREESLIP": 9,
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still a bit ugly, because it mirrors the information from
https://github.com/OceanParcels/Parcels/blob/997e3f86399cf319341a3d3f4fb1c5dc339e2580/parcels/include/index_search.h#L22-L30

It would be cleaner to either

  1. Use the string here in the CField, instead of an integer. I tried using c_char_p, but that didn't work (yet)
  2. Somehow import the typedefs from index_search.h (above) here
    In any case, I think we want to avoid happing two places where these mappings between strings and integers occur...

@erikvansebille
Copy link
Member Author

Will be solved in v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants