Skip to content

Merge Will's models - #1

Merged
vikasnataraja merged 9 commits into
vikasfrom
will
Aug 27, 2026
Merged

Merge Will's models#1
vikasnataraja merged 9 commits into
vikasfrom
will

Conversation

@vikasnataraja

Copy link
Copy Markdown
Collaborator

No description provided.

Jonah Shaw and others added 9 commits February 26, 2026 17:17
Includes xarray, numpy, matplotlib, pandas, netCDF4, and ipykernel
for running notebooks in the repository.
Simple energy models. Current values for constants such as thermal inertia, heat exchange, etc. are not tuned
2-layer model added which in theory is closest to what we want. Parameters are not tuned
Now uses emissivity and real values for CO2, which are included in the new data subdirectory
@vikasnataraja vikasnataraja self-assigned this Aug 27, 2026
Copilot AI lite review requested due to automatic review settings August 27, 2026 21:19
@vikasnataraja
vikasnataraja merged commit 3f53481 into vikas Aug 27, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The newly added Python script contains syntax/runtime errors (e.g., invalid function definition and datetime handling) that prevent it from running as-is.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds a plotting example script and CO₂ concentration datasets, alongside a pinned Python dependency set to support running the new code/data in this repository.

Changes:

  • Adds a new requirements.txt with pinned scientific Python dependencies.
  • Introduces J01-OLR_ASR_plotexample.py for OLR/ASR visualization and (in-progress) IEEI weighting logic.
  • Adds historical and SSP scenario CO₂ CSV datasets under data/.
File summaries
File Description
requirements.txt Adds pinned Python dependencies for the new analysis/plotting workflow.
J01-OLR_ASR_plotexample.py Adds plotting example code and preliminary IEEI/time-weight utilities.
data/co2_ssp_scenarios_2024_2100.csv Adds projected CO₂ SSP scenario time series for 2024–2100.
data/co2_historical_1850_2023.csv Adds historical CO₂ time series for 1850–2023.
Review details

Suppressed comments (1)

J01-OLR_ASR_plotexample.py:105

  • Month coordinates are 0-11, but xarray's time.dt.month is 1-12, so .sel(month=...) will fail (KeyError) for all months.
            "month": np.arange(12),
  • Files reviewed: 3/8 changed files
  • Comments generated: 10
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
Comment on lines +17 to +18
if ax is None:
fig, ax = plt.subplots(figsize=(10, 5))
scatter = ax.scatter(
olr_da,
asr_da,
c=olr_da['time.year']+0.083*olr_da['time.month'], #fractional year coordinate
Comment on lines +41 to +56
# Add a colorbar with discrete intervals and extend='both' keyword
# bounds = pd.date_range(
# start=pd.to_datetime(olr_da["time"].min().data),
# end=pd.to_datetime(olr_da["time"].max().data),
# periods=min(olr_da.sizes['time'],255))
bounds = np.arange(
olr_da['time.year'].min(),
olr_da['time.year'].max(),
max(1,(olr_da['time.year'].max()-olr_da['time.year'].min())/255))
norm = mpl.colors.BoundaryNorm(np.array(bounds), cmap.N, extend='both')

plt.colorbar(
mpl.cm.ScalarMappable(norm=norm, cmap=cmap),
ax=ax, orientation='vertical',
label="Time",
)
return fig, ax


def compute IEEI(
"""
Compute the integrated earth's energy imbalance (IEEI) from ASR and OLR fields.
"""
assert olr_ds["time"] == asr_ds["time"], "OLR and ASR time fields are not identical"
data=seconds_per_month,
dims=["month"],
coords={
"month": np.arange(12),
Comment on lines +109 to +126
time_weights = []
if account_for_leap == False:
for _t in time_ds:
time_weights.append(weights.sel(month=_t['time.month']))
else:
for _t in time_ds:
if _t["time.year"] % 4 == 0:
time_weights.append(weights_leap.sel(month=_t['time.month']))
else:
time_weights.append(weights.sel(month=_t['time.month']))

# Duplicate the time dimension but with weights as values
weights_ds = xr.DataArray(
data=time_weights,

)

return time_weights
Comment on lines +133 to +134

return weights.sel(month=time_step['time.month'])
Comment on lines +145 to +146
olr_da=xr.DataArray(olr, dims=["time"], coords={"time": np.arange(len(olr))}),
asr_da=xr.DataArray(asr, dims=["time"], coords={"time": np.arange(len(asr))}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants