Skip to content

Commit

Permalink
Merge pull request #843 from lee1043/plot_cmip5and6_compare
Browse files Browse the repository at this point in the history
CMIP5 and 6 comparing portrait and parallel coordinate plot
  • Loading branch information
lee1043 authored May 5, 2022
2 parents 5adf579 + 39ab23a commit 674ac2f
Show file tree
Hide file tree
Showing 8 changed files with 1,484 additions and 4 deletions.
4 changes: 4 additions & 0 deletions pcmdi_metrics/graphics/parallel_coordinate_plot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Parallel coordinate plot using matplotlib
- Mean Climate: [parallel_coordinate_plot_mean_clim.ipynb](./parallel_coordinate_plot_mean_clim.ipynb)

![plot](./mean_clim_parallel_coordinate_plot_example.png)

- Mean Climate, compare CMIP5 and CMIP6: [parallel_coordinate_plot_mean_clim_multiMIPs.ipynb](./parallel_coordinate_plot_mean_clim_multiMIPs.ipynb)

![plot](./mean_clim_parallel_coordinate_plot_cmip56.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def _quick_qc(data, model_names, metric_names, model_names2=None):
for model in model_names2:
if model not in model_names:
sys.exit(
"Error: model_names2 shoudl be a subset of model_names: "
"Error: model_names2 should be a subset of model_names, but "
+ model
+ " is not in model_names"
)
Expand Down Expand Up @@ -296,10 +296,11 @@ def _to_pd_dataframe(
group1_name="group1",
group2_name="group2",
):
print('data.shape:', data.shape)
# Pandas dataframe for seaborn plotting
df = pd.DataFrame(data, columns=metric_names, index=model_names)
# Stack
df_stacked = df.stack().reset_index()
df_stacked = df.stack(dropna=False).reset_index()
df_stacked = df_stacked.rename(
columns={"level_0": "Model", "level_1": "Metric", 0: "value"}
)
Expand Down

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pcmdi_metrics/graphics/portrait_plot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Portrait plot using matplotlib
- Mean Climate: [portrait_plot_mean_clim.ipynb](./portrait_plot_mean_clim.ipynb)

![plot](./mean_clim_portrait_plot_4seasons_example.png)

- Mean Climate, compare CMIP5 and CMIP6: [portrait_plot_mean_clim_multiple_CMIPs.ipynb](./portrait_plot_mean_clim_multiple_CMIPs.ipynb)

![plot](./mean_clim_portrait_plot_4seasons_cmip56.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 674ac2f

Please sign in to comment.