Closed erikvansebille closed 1 month ago
Hi @erikvansebille , I'd like to work on this enhancement. Could you please assign this issue to me?
Thank you!
Thanks @KOMPALALOKESH, for wanting to pick this up! I've assigned this Issue to you.
I think the key starting point is to make a new method in parcels/fieldset.py that returns a cls.from_netcdf(), a bit like how fieldset.from_b_grid()
is structured but then without much (any?) adjustments.
It would also be nice to add a unit test to tests/test_fieldset.py.
Good luck, and let us know if you need any help!
@KOMPALALOKESH if you're interested and want more than this issue, "Enable pyupgrade on ruff linting" from #1620 is well defined and might be interesting from a technical standpoint if you haven't worked with Ruff before. Its a nice Python tool, and modern Python is consolidating towards it for handling QAQC.
@erikvansebille , This PR Link introduces the FieldSet.from_a_grid_dataset() method in "parcels/fieldset.py" to handle A-grid datasets. A corresponding unit test has been added in "tests/test_fieldset.py" to validate this functionality.
Please review the changes and the test case. If everything is in order, kindly merge.
Parcels has specific methods for loading B-grid and C-grid datasets, but not for A-grids. This is because A-grid (linear) interpolation is default, so
FieldSet.from_netcdf()
automatically assumes an A-grid.However, for consistency and to help new users, it might be nice to add an explicit
FieldSet.from_a_grid_dataset()
method to Parcels. This method would then simply callfrom_netcdf()
.Note that while this is done, it might also be good to update a few mentions of
from_bgrid()
andfrom_cgrid()
in the docstrings to the correctfrom_b_grid_dataset()
andfrom_c_grid_dataset()