ECOv002-calval-tables 1.3.0__py3-none-any.whl → 1.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+
2
+ import matplotlib.pyplot as plt
3
+ import numpy as np
4
+ import matplotlib.lines as mlines
5
+ import os
6
+ import pandas as pd
7
+ from typing import Optional
8
+ from . import error_funcs
9
+
10
+ def quick_look_plot_single_model(
11
+ big_df_ss: pd.DataFrame,
12
+ time: str,
13
+ model_col: str,
14
+ model_name: str,
15
+ LE_var: str = 'LEcorr50',
16
+ output_filename: Optional[str] = None
17
+ ) -> None:
18
+ """
19
+ Plots the results for a single model against flux tower LE.
20
+ Parameters:
21
+ big_df_ss: pd.DataFrame containing all data
22
+ time: string for output file naming
23
+ model_col: column name for model output
24
+ model_name: display name for the model
25
+ LE_var: column name for flux tower LE (default 'LEcorr50')
26
+ output_filename: Optional path for output figure file. If None, figure is not saved.
27
+ """
28
+ colors = {
29
+ 'CRO': '#FFEC8B', 'CSH': '#AB82FF', 'CVM': '#8B814C',
30
+ 'DBF': '#98FB98', 'EBF': '#7FFF00', 'ENF': '#006400',
31
+ 'GRA': '#FFA54F', 'MF': '#8FBC8F', 'OSH': '#FFE4E1',
32
+ 'SAV': '#FFD700', 'WAT': '#98F5FF', 'WET': '#4169E1',
33
+ 'WSA': '#CDAA7D'
34
+ }
35
+ scatter_colors = [colors.get(veg, 'gray') for veg in big_df_ss['vegetation']]
36
+ one2one = np.arange(-250, 1200, 5)
37
+ def calculate_metrics(x, y):
38
+ rmse = error_funcs.rmse(y, x)
39
+ r2 = error_funcs.R2_fun(y, x)
40
+ slope, intercept = error_funcs.lin_regress(y, x)
41
+ bias = error_funcs.BIAS_fun(y,x)
42
+ return rmse, r2, slope, intercept, bias
43
+ x = big_df_ss[LE_var].to_numpy()
44
+ y = big_df_ss[model_col].to_numpy()
45
+ err = big_df_ss['ETinstUncertainty'].to_numpy() if 'ETinstUncertainty' in big_df_ss.columns else None
46
+ xerr = big_df_ss[['LE_filt', 'LEcorr50', 'LEcorr_ann']].std(axis=1).to_numpy() if all(col in big_df_ss.columns for col in ['LE_filt', 'LEcorr50', 'LEcorr_ann']) else None
47
+ rmse, r2, slope, intercept, bias = calculate_metrics(x, y)
48
+ number_of_points = np.sum(~np.isnan(y) & ~np.isnan(x))
49
+ fig, ax = plt.subplots(figsize=(6, 6))
50
+ if err is not None and xerr is not None:
51
+ ax.errorbar(x, y, yerr=err, xerr=xerr, fmt='none', ecolor='lightgray')
52
+ ax.scatter(x, y, c=scatter_colors, marker='o', s=6, zorder=4)
53
+ ax.plot(one2one, one2one, '--', c='k')
54
+ ax.plot(one2one, one2one * slope + intercept, '--', c='gray')
55
+ ax.set_title(model_name)
56
+ ax.set_xlim([-250, 1200])
57
+ ax.set_ylim([-250, 1200])
58
+ ax.set_ylabel('Model LE Wm$^{-2}$',fontsize=14)
59
+ ax.set_xlabel('Flux Tower LE Wm$^{-2}$',fontsize=14)
60
+ ax.text(-0.1, 1.1, 'a)', transform=ax.transAxes, fontsize=16, fontweight='bold', va='top', ha='right')
61
+ ax.text(500, -200, f'y = {slope:.1f}x + {intercept:.1f} \nRMSE: {rmse:.1f} Wm$^-$² \nbias: {bias:.1f} Wm$^-$² \nR$^2$: {r2:.2f}', fontsize=12)
62
+ scatter_handles = [mlines.Line2D([], [], color=color, marker='o', linestyle='None', markersize=6, label=veg) for veg, color in colors.items()]
63
+ fig.legend(handles=scatter_handles, loc='lower center', bbox_to_anchor=(0.5, -0.05), ncol=7, title='Vegetation Type',fontsize=10)
64
+ fig.subplots_adjust(bottom=0.2)
65
+ fig.tight_layout()
66
+ if output_filename is not None:
67
+ fig.savefig(output_filename, dpi=600, bbox_inches='tight')
68
+ # Return the figure object for notebook display
69
+ return fig
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ECOv002-calval-tables
3
- Version: 1.3.0
3
+ Version: 1.5.0
4
4
  Summary: Priestley-Taylor Jet Propulsion Laboratory Soil Moisutre Evapotranspiration Model
5
5
  Author-email: Gregory Halverson <gregory.h.halverson@jpl.nasa.gov>, Zoe Pierrat <zoe.a.pierrat@jpl.nasa.gov>
6
6
  Project-URL: Homepage, https://github.com/gregory-halverson/ECOv002-calval-tables
@@ -11,6 +11,12 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: pandas
13
13
  Requires-Dist: geopandas
14
+ Requires-Dist: numpy
15
+ Requires-Dist: tables
16
+ Requires-Dist: scikit-learn
17
+ Requires-Dist: scipy
18
+ Requires-Dist: matplotlib
19
+ Requires-Dist: shapely
14
20
  Provides-Extra: dev
15
21
  Requires-Dist: build; extra == "dev"
16
22
  Requires-Dist: pytest>=6.0; extra == "dev"
@@ -0,0 +1,15 @@
1
+ ECOv002_calval_tables/ECOv002_calval_tables.py,sha256=k8y7TEevSX3Y6NhEU1qg_CySd-f_T4omNNJFc7ZxXcY,135
2
+ ECOv002_calval_tables/__init__.py,sha256=oO0pVascuJs247UwpXq2o23wQPThM1bWEwUhSYiNzMY,60
3
+ ECOv002_calval_tables/combined_eco_flux_EC_filtered.csv,sha256=uSRv1CBMJKUWBgtMlRHB1359kiUFUL1ez2c4m7C4DxU,745225
4
+ ECOv002_calval_tables/ec_lib.py,sha256=0k7CldHMFrcq77OqsXdreJQNEVUHVMCAHmUWNo-63fA,24676
5
+ ECOv002_calval_tables/error_funcs.py,sha256=WFsoYvZyJVF-ppBn0BV2JJADPZN48OJBG2QZ6Lt3uCk,11275
6
+ ECOv002_calval_tables/load_tables.py,sha256=m9UEz07yIrM-m2PaYv2g_TnBLN5Wjg7yUuMzs-T25Gk,2685
7
+ ECOv002_calval_tables/metadata_ebc_filt.csv,sha256=74AeCH5DG2Zu8ZFBXUZAW95hlsCjK9K3t6BWRRReR3s,13975
8
+ ECOv002_calval_tables/plot_funcs.py,sha256=asu43YEtWhNehBRKx5ujIiqNn6iePbXW6fC_8Tl8yzI,23988
9
+ ECOv002_calval_tables/plot_single_model.py,sha256=9OyyqU3IsiuV20yFSULQFaec87xdZhbZevMTIG83xBg,3279
10
+ ECOv002_calval_tables/version.py,sha256=DOnf2BIAf7HAp9SIUIetrDgRoZDL0o7JuKSiC7_ZT_I,87
11
+ ecov002_calval_tables-1.5.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
+ ecov002_calval_tables-1.5.0.dist-info/METADATA,sha256=3E1QUMG0_d2o-n2Bs_rGo0ZwmF6fvufK7xrQU44h7qI,3312
13
+ ecov002_calval_tables-1.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ ecov002_calval_tables-1.5.0.dist-info/top_level.txt,sha256=ePbA84g_XQHWQUAQEVo6gmyuW0WLUzPg2IfHyoGqUqg,22
15
+ ecov002_calval_tables-1.5.0.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- ECOv002_calval_tables/ECOv002_calval_tables.py,sha256=R0H6t0HHBSxYsSzrdeYVrIcxXZfB68Yol3s-DN2BkXE,2623
2
- ECOv002_calval_tables/__init__.py,sha256=oO0pVascuJs247UwpXq2o23wQPThM1bWEwUhSYiNzMY,60
3
- ECOv002_calval_tables/combined_eco_flux_EC_filtered.csv,sha256=uSRv1CBMJKUWBgtMlRHB1359kiUFUL1ez2c4m7C4DxU,745225
4
- ECOv002_calval_tables/metadata_ebc_filt.csv,sha256=74AeCH5DG2Zu8ZFBXUZAW95hlsCjK9K3t6BWRRReR3s,13975
5
- ECOv002_calval_tables/version.py,sha256=DOnf2BIAf7HAp9SIUIetrDgRoZDL0o7JuKSiC7_ZT_I,87
6
- ecov002_calval_tables-1.3.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
7
- ecov002_calval_tables-1.3.0.dist-info/METADATA,sha256=VCQO10ykEIGnEPRfWaq80UpoDxGrgcYw6VJUuBr2Hj0,3171
8
- ecov002_calval_tables-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- ecov002_calval_tables-1.3.0.dist-info/top_level.txt,sha256=ePbA84g_XQHWQUAQEVo6gmyuW0WLUzPg2IfHyoGqUqg,22
10
- ecov002_calval_tables-1.3.0.dist-info/RECORD,,