-
Notifications
You must be signed in to change notification settings - Fork 34
New Feature: Support plotting native grid data in lat_lon plots #968
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
Changes from 24 commits
7bc760c
cc21bd2
e902660
5e2741b
c33df95
cb49bf5
4740a8b
108a660
05cb53a
1b2c5ff
f3a9a89
5291d78
99fdf26
fefb25f
bab6b04
2898e8d
bb7dd22
4605fac
da3b9a3
4340524
399a95e
8f9521e
8fa1800
60f1084
0233432
54ab380
4f70de2
8e5b847
d887088
8944b82
8b72480
5a71782
3af5471
bf31962
ed2b5f0
33ba31e
11f8cd9
2cca3ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import uxarray as ux | ||
| import matplotlib.pyplot as pl | ||
| import cartopy.crs as ccrs | ||
| import cartopy.feature as cfeature | ||
|
|
||
| base_path = "/Users/zhang40/Documents/ACME_simulations/E3SM_v2/native_grid_data/" | ||
| grid_info = "ne30pg2" | ||
| grid_path = base_path + f"{grid_info}.nc" | ||
| data_path = base_path + f"PRECC.{grid_info}.nc" | ||
|
|
||
| uxds = ux.open_dataset(grid_path, data_path) | ||
|
|
||
| pc = uxds["PRECT"].to_polycollection() | ||
| #pc = uxds["PRECT"].to_polycollection(periodic_elements="split") | ||
|
|
||
| # disables grid lines | ||
| pc.set_antialiased(False) | ||
|
|
||
| pc.set_cmap("plasma") | ||
|
|
||
| fig, ax = plt.subplots( | ||
| 1, | ||
| 1, | ||
| figsize=(10, 5), | ||
| facecolor="w", | ||
| constrained_layout=True, | ||
| subplot_kw=dict(projection=ccrs.PlateCarree()), | ||
| ) | ||
|
|
||
| ax.add_feature(cfeature.COASTLINE) | ||
| ax.add_feature(cfeature.BORDERS) | ||
|
|
||
| ax.add_collection(pc) | ||
| ax.set_global() | ||
| plt.title("PolyCollection Plot with Projection & Features") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ dependencies: | |
| - numpy >=2.0.0,<3.0.0 | ||
| - pywavelets | ||
| - scipy | ||
| - uxarray >=2023.3.0,<2025.6.0 | ||
|
||
| - xcdat >=0.9.1,<1.0.0 | ||
| - xesmf >=0.8.7 | ||
| - xskillscore >=0.0.20 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -624,6 +624,18 @@ | |
| ("hfss",): rename, | ||
| ("surf_sens_flux",): rename, # EAMxx | ||
| }, | ||
| "TGCLDLWP": OrderedDict( | ||
| [ | ||
| ( | ||
| ("TGCLDLWP",), | ||
| lambda x: convert_units(x, target_units="g/m^2"), | ||
| ), | ||
| ( | ||
| ("LiqWaterPath",), | ||
| lambda x: convert_units(x, target_units="g/m^2"), | ||
| ), # EAMxx | ||
| ] | ||
| ), | ||
|
Comment on lines
+627
to
+638
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace with regular dictionary |
||
| "TGCLDLWP_OCN": OrderedDict( | ||
| [ | ||
| ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,119 @@ | ||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["PRECT"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| regions = ["global", "60S60N", "30S30N-150E90W"] | ||||
| test_colormap = "WhiteBlueGreenYellowRed.rgb" | ||||
| reference_colormap = "WhiteBlueGreenYellowRed.rgb" | ||||
| diff_colormap = "BrBG" | ||||
| contour_levels = [0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16] | ||||
| diff_levels = [-2.5, -2, -1.5, -1, -0.5, -0.25, 0.25, 0.5, 1, 1.5, 2, 2.5] | ||||
|
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["PRECC"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| regions = ["global", "60S60N", "30S30N-150E90W"] | ||||
| test_colormap = "WhiteBlueGreenYellowRed.rgb" | ||||
| reference_colormap = "WhiteBlueGreenYellowRed.rgb" | ||||
| diff_colormap = "BrBG" | ||||
| contour_levels = [0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16] | ||||
| diff_levels = [-2.5, -2, -1.5, -1, -0.5, -0.25, 0.25, 0.5, 1, 1.5, 2, 2.5] | ||||
|
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["TGCLDLWP"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| regions = ["global", "60S60N", "30S30N-150E90W"] | ||||
| #test_colormap = "Blues" | ||||
| #reference_colormap = "Blues" | ||||
| diff_colormap = "RdBu" | ||||
| #contour_levels = [10, 25, 50, 75, 100, 125, 150, 175, 200,225, 250] | ||||
| diff_levels = [-35, -30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30, 35] | ||||
|
|
||||
|
|
||||
|
|
||||
|
Comment on lines
+37
to
+38
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["TREFHT"] | ||||
| regions = ["global"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| contour_levels = [-35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40] | ||||
| diff_levels = [-5, -4, -3, -2, -1, -0.5, -0.2, 0.2, 0.5, 1, 2, 3, 4, 5] | ||||
|
|
||||
|
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["SWCFSRF"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| contour_levels = [-170, -150, -135, -120, -105, -90, -75, -60, -45, -30, -15, 0, 15, 30, 45] | ||||
| diff_levels = [-30, -25, -20, -15, -10, -5, -2, 2, 5, 10, 15, 20, 25, 30] | ||||
|
|
||||
|
|
||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["LWCFSRF"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| contour_levels = [0, 10, 20, 30, 40, 50, 60, 70, 80] | ||||
| diff_levels = [-30, -25, -20, -15, -10, -5, -2, 2, 5, 10, 15, 20, 25, 30] | ||||
|
|
||||
|
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["LHFLX"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| contour_levels = [0,5, 15, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300] | ||||
| diff_levels = [-75, -50, -25, -10, -5, -2, 2, 5, 10, 25, 50, 75] | ||||
|
|
||||
|
|
||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["SHFLX"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| contour_levels = [-100, -75, -50, -25, -10, 0, 10, 25, 50, 75, 100, 125, 150] | ||||
| diff_levels = [-75, -50, -25, -10, -5, -2, 2, 5, 10, 25, 50, 75] | ||||
|
|
||||
|
|
||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["NET_FLUX_SRF"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| contour_levels = [-200, -160, -120, -80, -40, 0, 40, 80, 120, 160, 200] | ||||
| diff_levels = [-75, -50, -25, -10, -5, -2, 2, 5, 10, 25, 50, 75] | ||||
|
|
||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
|
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["TMQ"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| contour_levels = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60] | ||||
| diff_levels = [-12, -9, -6, -4, -3, -2, -1, 1, 2, 3, 4, 6, 9, 12] | ||||
|
|
||||
|
|
||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["QREFHT"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| contour_levels = [0.2, 0.5, 1, 2.5, 5, 7.5, 10, 12.5, 15, 17.5] | ||||
| diff_levels = [-5, -4, -3, -2, -1, -0.25, 0.25, 1, 2, 3, 4, 5] | ||||
|
|
||||
| [#] | ||||
| sets = ["lat_lon_native"] | ||||
| case_id = "model_vs_model" | ||||
| variables = ["U10"] | ||||
| seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"] | ||||
| test_colormap = "PiYG_r" | ||||
| reference_colormap = "PiYG_r" | ||||
| contour_levels = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] | ||||
| diff_levels = [-8, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 8] | ||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [#] | ||
| sets = ["lat_lon_native"] | ||
| case_id = "model_vs_obs" | ||
| variables = ["PRECT"] | ||
| seasons = ["ANN", "DJF", "MAM", "JJA", "SON"] | ||
| regions = ["global"] | ||
| test_colormap = "WhiteBlueGreenYellowRed.rgb" | ||
| reference_colormap = "WhiteBlueGreenYellowRed.rgb" | ||
| diff_colormap = "BrBG" | ||
| contour_levels = [0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16] | ||
| diff_levels = [-2.5, -2, -1.5, -1, -0.5, -0.25, 0.25, 0.5, 1, 1.5, 2, 2.5] | ||
|
|
||
| # Native grid settings | ||
| grid_file = "" | ||
| split_periodic_elements = True | ||
| antialiased = False |
Uh oh!
There was an error while loading. Please reload this page.