From 1cf3ca477bfa94f43d6d9bb5d40e7f1021332da0 Mon Sep 17 00:00:00 2001 From: ChiaraMonforte Date: Tue, 5 Nov 2024 09:18:52 +0100 Subject: [PATCH 1/2] [FIX] Consistent font size in demo titles + no error legend message in w plot --- glidertest/tools.py | 18 +++++++++++++++--- notebooks/demo.ipynb | 10 +++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/glidertest/tools.py b/glidertest/tools.py index eb3172b..416215c 100644 --- a/glidertest/tools.py +++ b/glidertest/tools.py @@ -1226,11 +1226,23 @@ def plot_combined_velocity_profiles(ds_out_dives, ds_out_climbs): fig, ax = plt.subplots(1, 1, figsize=(4.8, 4.8)) + conv_factor = 100 # Convert m/s to cm/s + depth_negative = ds_out_dives.zgrid.values * -1 + meanw_dives = ds_out_dives.meanw.values * conv_factor + zgrid_dives = depth_negative + w_lower_dives = ds_out_dives.w_lower.values * conv_factor + w_upper_dives = ds_out_dives.w_upper.values * conv_factor + + meanw_climbs = ds_out_climbs.meanw.values * conv_factor + zgrid_climbs = ds_out_climbs.zgrid.values * -1 + w_lower_climbs = ds_out_climbs.w_lower.values * conv_factor + w_upper_climbs = ds_out_climbs.w_upper.values * conv_factor + fig, ax = plt.subplots(1, 1, figsize=(4.8, 4.8)) + ax.xaxis.label.set_size(14) ax.yaxis.label.set_size(14) ax.tick_params(axis='both', which='major', labelsize=14) - ax.legend(fontsize=14) # Plot dives ax.fill_betweenx(zgrid_dives, w_lower_dives, w_upper_dives, color='black', alpha=0.3) @@ -1245,8 +1257,8 @@ def plot_combined_velocity_profiles(ds_out_dives, ds_out_climbs): ax.set_xlabel('Vertical Velocity w (cm s$^{-1}$)') ax.set_ylabel('Depth (m)') ax.set_ylim(top=0, bottom=1000) # Set y-limit maximum to zero - ax.legend() -# ax.set_title('Combined Vertical Velocity Profiles') + ax.legend(fontsize=14) + #ax.set_title('Combined Vertical Velocity Profiles') ax.set_xlim(-1, 1.5) ax.set_xticks([-1, -0.5, 0, 0.5, 1.0, 1.5]) diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb index 5a24020..de44686 100644 --- a/notebooks/demo.ipynb +++ b/notebooks/demo.ipynb @@ -92,7 +92,7 @@ "id": "6b93a2ef", "metadata": {}, "source": [ - "### Vertical velocity" + "# Vertical velocity" ] }, { @@ -147,7 +147,7 @@ "id": "d22b9ca5", "metadata": {}, "source": [ - "# Basic statistics of dataset" + "### Basic statistics of dataset" ] }, { @@ -206,7 +206,7 @@ "id": "34dd4862-c730-49f8-973b-f533407c9e79", "metadata": {}, "source": [ - "## Check if the profile number was assigned well \n", + "### Check if the profile number was assigned well \n", "\n", "We want to check if the profile number is consistently increasing or not.\n", "When using pyglider to assign the profile, there can be some issues if the correct pressure and time threshold is not chosen.\n", @@ -457,7 +457,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -471,7 +471,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.7" + "version": "3.11.8" } }, "nbformat": 4, From e1a4547e50ce227e8660f29e396ea3c948566b76 Mon Sep 17 00:00:00 2001 From: ChiaraMonforte Date: Tue, 5 Nov 2024 09:20:40 +0100 Subject: [PATCH 2/2] Added everything and actually saved --- glidertest/tools.py | 14 -------------- notebooks/demo.ipynb | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/glidertest/tools.py b/glidertest/tools.py index 416215c..79a8f47 100644 --- a/glidertest/tools.py +++ b/glidertest/tools.py @@ -1224,20 +1224,6 @@ def plot_combined_velocity_profiles(ds_out_dives, ds_out_climbs): w_lower_climbs = ds_out_climbs.w_lower.values * conv_factor w_upper_climbs = ds_out_climbs.w_upper.values * conv_factor - fig, ax = plt.subplots(1, 1, figsize=(4.8, 4.8)) - - conv_factor = 100 # Convert m/s to cm/s - depth_negative = ds_out_dives.zgrid.values * -1 - meanw_dives = ds_out_dives.meanw.values * conv_factor - zgrid_dives = depth_negative - w_lower_dives = ds_out_dives.w_lower.values * conv_factor - w_upper_dives = ds_out_dives.w_upper.values * conv_factor - - meanw_climbs = ds_out_climbs.meanw.values * conv_factor - zgrid_climbs = ds_out_climbs.zgrid.values * -1 - w_lower_climbs = ds_out_climbs.w_lower.values * conv_factor - w_upper_climbs = ds_out_climbs.w_upper.values * conv_factor - fig, ax = plt.subplots(1, 1, figsize=(4.8, 4.8)) ax.xaxis.label.set_size(14) diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb index de44686..e4e46d0 100644 --- a/notebooks/demo.ipynb +++ b/notebooks/demo.ipynb @@ -92,7 +92,7 @@ "id": "6b93a2ef", "metadata": {}, "source": [ - "# Vertical velocity" + "### Vertical velocity" ] }, {