British-Oceanographic-Data-Centre / COAsT

A Coastal Ocean Assessment Tool built as an extendable python framework for nemo models
https://british-oceanographic-data-centre.github.io/COAsT/
MIT License
24 stars 11 forks source link

Cartopy bug when plotting quivers #628

Closed b-barton closed 11 months ago

b-barton commented 11 months ago

There is a bug in cartopy when plotting quivers using a stereographic projection. This is hard to understand when a correction to the quivers is also needed for plotting NEMO currents over the North Pole. There is a correction that can be added to when plotting currents over the pole. The bug has been un-resolved in cartopy for several years.

There are additional functions needed to enable plotting NEMO velocities in general so that the curvilinear grid i, j currents are projected in northwards and westwards currents that can be plotted in CartoPy.

Branch made bug/#628_cartopy_quivers

AC:

b-barton commented 11 months ago

Added functions in plot_util.py: velocity_polar() make_projection() velocity_rotate() grid_angle() velocity_on_t() velocity_grid_to_geo()

b-barton commented 11 months ago

I've taken this a little further than the bug states. velocity_polar() fixes the cartopy bug but id doesn't make sense to just fix the bug without the other utilities for plotting NEMO velocities as quivers.

b-barton commented 11 months ago

I've added some unit tests for each function. I need to make sure they work.

b-barton commented 11 months ago

I've run the tests and they pass. I'm going to check how it works with some real NEMO data before suggesting to merge.

b-barton commented 11 months ago

I'm having problems running the build tests on Windows (Windows fatal exception: access violation). I've only added code not changed any so don't expect the tests to fail. Could someone else check the tests for me.

b-barton commented 11 months ago

I have been able to run most of the tests. test_gridded_initialisation and test_tidegauge_methods don't seem to run on my laptop, I don't think it is anything related to the functions I've added just weird windows things.