-
Notifications
You must be signed in to change notification settings - Fork 2
lat & lon profiles plot as Diagnostic tool #1934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
logger = log_configure(loglevel, 'plot_lat_lon_profiles') | ||
ConfigStyle(style=style, loglevel=loglevel) | ||
|
||
def data_coordinate_means(data, mean_type : str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defining this function inside the other is not really the style which we used in AQUA. If this functuon is used only by plot_lat_lon_profiles() the start its name with "_" (ie def _data_coordinate_means(...
) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes my plan was to move it in one of the util
folders, so that other functions might be able to use it, also because is not a super specific computation. You think it would be better to keep it here and private?
raise ValueError("mean_type must be 'zonal' or 'meridional'") | ||
|
||
|
||
if data_list is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If data_list is not none what is plotted monthly data or annual_data? I would pass only one "data" object. Then you can test if it a slist (and iterate over it) or do only one plot
if mean_type == 'zonal': | ||
return data.mean(dim='lon') | ||
elif mean_type == 'meridional': | ||
return data.mean(dim='lat') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure that this is wrong ... the mean should be a weighted mean (weighting by cell areas)!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I agree with you. I was trying to display the plots on the notebook first, and now I'll compute the weighted-area mean
@jhardenberg thanks for your review. Yes you may have noticed that this PR is still quite draft, and it still needs some work. Thanks for your suggestions! |
… and annual data methods
logger = log_configure(loglevel, 'plot_lat_lon_profiles') | ||
ConfigStyle(style=style, loglevel=loglevel) | ||
|
||
def data_coordinate_means(data, mean_type : str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk if this is worth an entire function. Btw, is this defined inside the other function? If yes I'd avoid this
from .styles import ConfigStyle | ||
|
||
def plot_lat_lon_profiles(monthly_data: xr.DataArray = None, | ||
annual_data: xr.DataArray = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use only data argument instead of monthly and annual
|
||
def plot_lat_lon_profiles(monthly_data: xr.DataArray = None, | ||
annual_data: xr.DataArray = None, | ||
data_labels: list = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing reference arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also missing the std argument for the reference
src/aqua/graphics/multiple_lines.py
Outdated
from .styles import ConfigStyle | ||
from .lat_lon_profiles import plot_lat_lon_profiles | ||
|
||
def plot_multi_lines(data_arrays_list, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if this can be totally removed
lat_limits=lat_limits) | ||
|
||
# Initialize the possible results | ||
self.hourly = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only self. annual and self.seasonal
else: | ||
self.data.attrs['standard_name'] = var | ||
|
||
def compute_std(self, freq: str, exclude_incomplete: bool = True, center_time: bool = True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep it commented for now
elif str_freq == 'annual': | ||
self.std_annual = data | ||
|
||
def save_netcdf(self, diagnostic: str, freq: str, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to correct according to your new results
with various data arrays for different frequencies (hourly, daily, | ||
monthly, annual, seasonal annual) and their standard deviations. | ||
""" | ||
def __init__(self, hourly_data=None, daily_data=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change input args
from aqua.logger import log_configure | ||
from .plot_base import PlotBaseMixin | ||
|
||
class PlotLatLonProfiles(PlotBaseMixin): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove mixin, take the individual class taking care of annual plot and seasonal plot with two methods
…ultiple_lines because redundant
…nput in PlotLatLonProfiles
PR description:
The aim of this PR is to make the zonal and longitudinal profiles plot from the Tropical Rainfall diagnostic part of the AQUA diagnostic tools.
Issues closed by this pull request:
Close #1923