Repository navigation
Conversation
|
This needs to be updated. |
|
Can we just save the basin code generated from
|
e85ba04 to
bed7489
Compare
|
|
|
Please add the SouthernOcean60S, as it is a critical region for CESM3 development. |
Added back. |
|
For regional applications, it would be useful to be able to provide the path to a "basin_code" to the script, e.g.:
|
Should I add it to all scripts that use |
|
Yes, please. You might need to add it to the Papermill arguments in |
In some scripts, not all basins are used, e.g., Should I add another flag for that, or just use all regions? Either way, I think it should be consistent across all scripts. |
3ec2ba0 to
e145c1f
Compare
Also, would it be better to implement this optional path through |
|
Here is a workflow for reviewing all the basin masks generated: |
* Add Basin 16: Arctic Ocean north of 80N * Switch to genBasinMasks for comnpute_basin_reductions.py and drift.py
* Add Basin 16: Arctic Ocean north of 80N to nb_templates/ts.ipynb * Remove Maritime and SouthernOcean60S from nb_templates/ts.ipynb * Switch to genBasinMasks for nb_templates/climo.ipynb
Add SouthernOcean60S back
Adds a -b/--basin CLI flag to drift.py, TS_levels.py, moc.py, moc_sigma2.py, diff_rms.py, stats.py, compute_basin_reductions.py, poleward_heat_transport.py, and create_climatology.py, letting users read pre-computed basin masks from a netCDF file. This is done through the additional argument, basin_from_file, passed to genBasinMasks(). moc.py and poleward_heat_transport.py now derive their composite Atlantic/Indo-Pacific masks by specifying region name instead of numeric basin codes. Removed the unused genBasinMasks import from aaiw_pv.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Set xda=True by default, since codes 12-17 are overlapping sub-regions and can only be represented when xda=True. Also updated docs/source/examples. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
genBasinMasks assumed plain numpy arrays internally, but some callers (e.g. nb_templates/climo.ipynb, which passes grd.geolon/grd.geolat/depth from an xarray-format grid without .values) pass xarray DataArrays instead. xarray disallows 2-dimensional boolean array indexing through plain [] syntax, so the NaN-removal line and every code[tmp>0] = N basin assignment raised "IndexError: 2-dimensional boolean indexing is not supported" as soon as x/y/depth were xarray-backed. Fix by normalizing x, y, depth to plain numpy via np.asarray() at the top of the function, before any boolean-mask logic runs. Verified against a synthetic grid with both xarray and plain numpy inputs, xda=True and xda=False. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Checked. Arctic80N and SouthernOcean60S cover the basins as intended. |
|
Should we keep the |
Also use genBasinMasks to specify basin code in
compute_basin_reduction.pyanddrift.py.