From 886c193684d72b6ed885a17874acb539ba0488a7 Mon Sep 17 00:00:00 2001 From: didillysquat Date: Wed, 13 Jul 2022 11:23:48 +0200 Subject: [PATCH] site plotting across dateline --- reefmapmaker/reefmapmaker.py | 52 +++++++++++++++++++++++++----------- setup.py | 2 +- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/reefmapmaker/reefmapmaker.py b/reefmapmaker/reefmapmaker.py index 64522ad..a66fa79 100755 --- a/reefmapmaker/reefmapmaker.py +++ b/reefmapmaker/reefmapmaker.py @@ -44,7 +44,7 @@ warnings.filterwarnings("ignore", category=DownloadWarning) -__version__ = "v0.1.9" +__version__ = "v0.1.10" class ReefMapMaker: @@ -931,26 +931,46 @@ def _plot_user_points(self): print('plotting user reefs\n') line_widths = ((self.site_df['radius_in_deg'].astype( float) * 2) * self.coord_to_point_scaler) * 0.1 - self.large_map_ax.scatter( - x=self.site_df['longitude_deg_e'], - y=self.site_df['latitude_deg_n'], - s=(((self.site_df['radius_in_deg'].astype( - float) * 2) * self.coord_to_point_scaler) ** 2), - facecolors=self.site_df['facecolor'], - edgecolors=self.site_df['edgecolor'], zorder=3, - linewidths=line_widths - ) + if self.date_line_centered: + self.large_map_ax.scatter( + x=[self._convert_point_coord_to_new_xcoords_central(_) for _ in self.site_df['longitude_deg_e']], + y=self.site_df['latitude_deg_n'], + s=(((self.site_df['radius_in_deg'].astype( + float) * 2) * self.coord_to_point_scaler) ** 2), + facecolors=self.site_df['facecolor'], + edgecolors=self.site_df['edgecolor'], zorder=3, + linewidths=line_widths + ) + else: + self.large_map_ax.scatter( + x=self.site_df['longitude_deg_e'], + y=self.site_df['latitude_deg_n'], + s=(((self.site_df['radius_in_deg'].astype( + float) * 2) * self.coord_to_point_scaler) ** 2), + facecolors=self.site_df['facecolor'], + edgecolors=self.site_df['edgecolor'], zorder=3, + linewidths=line_widths + ) def _annotate_site_labels(self): if self.config_dict['user_site_labels']: for ind in self.site_df.index: - self.large_map_ax.annotate( - ind, - ( - self.site_df.at[ind, 'longitude_deg_e'] + self.site_df.at[ind, 'radius_in_deg'], - self.site_df.at[ind, 'latitude_deg_n'] + self.site_df.at[ind, 'radius_in_deg'] + if self.date_line_centered: + self.large_map_ax.annotate( + ind, + ( + self._convert_point_coord_to_new_xcoords_central(self.site_df.at[ind, 'longitude_deg_e']) + self.site_df.at[ind, 'radius_in_deg'], + self.site_df.at[ind, 'latitude_deg_n'] + self.site_df.at[ind, 'radius_in_deg'] + ) + ) + else: + self.large_map_ax.annotate( + ind, + ( + self.site_df.at[ind, 'longitude_deg_e'] + self.site_df.at[ind, 'radius_in_deg'], + self.site_df.at[ind, 'latitude_deg_n'] + self.site_df.at[ind, 'radius_in_deg'] + ) ) - ) def _add_reference_reefs(self): """ diff --git a/setup.py b/setup.py index a79ae12..86a5039 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setuptools.setup( name="reefmapmaker", - version='0.1.9', + version='0.1.10', author="Benjamin C C Hume", author_email="didillysquat@gmail.com", description="Script to plot maps with reference coral reefs annotated.",