Last active
September 7, 2020 23:27
-
-
Save navidcy/5034891d186f65e2f0bcaab1141b3442 to your computer and use it in GitHub Desktop.
Merge output from multiple IAF cycles that all start at 1958
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# loat temp data from the two IAF cycles | |
temp_cycle1 = cc.querying.getvar('01deg_jra55v140_iaf', 'temp', session, ncfile='ocean-3d-temp-1-monthly-mean-ym_%.nc') | |
temp_cycle2 = cc.querying.getvar('01deg_jra55v140_iaf_cycle2', 'temp', session, ncfile='ocean-3d-temp-1-monthly-mean-ym_%.nc') | |
# The above data arrays have monthly temporal resolution. | |
# We would like to shift the time-axis of `cycle2` so | |
# as to plot them as a contiguous time-series, | |
# find out how many months we need to shift `cycle2` | |
howmanymonths = str(temp_010_cycle1_IAF_all.time.size + 1) + 'M' | |
# shift time axis of cycle2 by `howmanymonths` | |
temp_cycle2 = temp_cycle2.assign_coords(time = temp_cycle1.time + xr.coding.cftime_offsets.to_offset(howmanymonths)) | |
# merge the two data arrays | |
temp = xr.concat([temp_cycle1, temp_cycle2], 'time') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment