tplot-ch-test.py - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch) (HTM) git clone git://src.adamsgaard.dk/pism (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- tplot-ch-test.py (1691B) --- 1 #!/usr/bin/env python3 2 3 import PISM 4 import numpy as np 5 import pylab as plt 6 import ch_warming 7 year_length = float(365 * 86400) 8 9 z, times, T_ice, W_ice, T_ch, W_ch = ch_warming.run(Lz=200, Mz=201, T_final_years=4, R=20) 10 11 t = 86400 * np.linspace(0, 365, 366) 12 Ts = ch_warming.T_surface(t, mean=268.15, amplitude=6, summer_peak_day=365/2) 13 melt_season_length = np.count_nonzero(Ts > ch_warming.T_melting) 14 print("The melt season is {} weeks long.".format(melt_season_length / 7)) 15 16 plt.figure(figsize=(10, 5)) 17 plt.plot(t / 86400, Ts) 18 plt.xlabel("time, days") 19 plt.ylabel("Air temperature, Kelvin") 20 plt.grid() 21 plt.savefig("air-temperature.png") 22 23 N = z.size - 16 24 plt.figure(figsize=(10, 5)) 25 plt.title("Ice temperature at depth over time") 26 plt.pcolormesh(times / year_length, z[N:], T_ice.T[N:, :]) 27 plt.xlabel("time, years") 28 plt.ylabel("z, meters") 29 plt.colorbar() 30 plt.grid() 31 plt.savefig("ice-temperature.png") 32 33 N = z.size - 16 34 plt.figure(figsize=(10, 5)) 35 plt.title("Temperature in the CH system") 36 plt.pcolormesh(times / year_length, z[N:], T_ch.T[N:, :]) 37 plt.xlabel("time, years") 38 plt.ylabel("z, meters") 39 plt.colorbar() 40 plt.grid() 41 plt.savefig("ch-temperature.png") 42 43 N = z.size - 16 44 plt.figure(figsize=(10, 5)) 45 plt.title("Water fraction in the CH system") 46 plt.pcolormesh(times / year_length, z[N:], W_ch.T[N:, :]) 47 plt.xlabel("time, years") 48 plt.ylabel("z, meters") 49 plt.colorbar() 50 plt.grid() 51 plt.savefig("ch-water-fraction.png") 52 53 plt.figure(figsize=(10, 5)) 54 N = z.size-16 55 for k in np.r_[N:z.size]: 56 plt.plot(times/year_length, T_ice[:, k]) 57 58 plt.xlabel("time, years") 59 plt.ylabel("temperature, Kelvin") 60 plt.title("Ice temperature at different depths") 61 plt.grid() 62 plt.savefig("ice-temperature-curves.png")