<jupyter_start><jupyter_text>Import the Land-Sea Mask data<jupyter_code>fname = "ERA_landsea_mask.nc"
rootgrp = Dataset(fname, 'r')
landsea_mask = np.flip(np.squeeze(rootgrp.variables['lsm'][:]), axis=0)
LAT = np.flip(rootgrp.variables['latitude'][:], axis=0)
LON = rootgrp.variables['longitude'][:]<jupyter_output><empty_output><jupyter_text>Import the ERA-interim Annually Averaged Precipitation<jupyter_code>with open("avg_precip.txt", "rb") as f:
    precip = pickle.load(f)

avg_precip = precip["monthly_precip"] * (365/1000.0) #convert mm/day to m/year<jupyter_output><empty_output><jupyter_text>Plot the map of the precipitation<jupyter_code>fig=plt.figure(figsize=(20,10))
m = Basemap(projection='mill',lon_0=180)
lons, lats = np.meshgrid(LON, LAT)
xi, yi = m(lons, lats)
cs = m.contourf(xi, yi, avg_precip, vmin=0,vmax=10, cmap=plt.get_cmap("Blues"))
m.drawcoastlines(color="black")
cbar = plt.colorbar(cs)
cbar.set_label('mean precipitation rate (m/yr)')
plt.title('Annual Mean Precipitation 1979-2018 ERA-interim')<jupyter_output><empty_output><jupyter_text>Get Zonal Mean (Global and Land Only)<jupyter_code>global_precip = np.nanmean(avg_precip,axis=1)

land_precip = np.where(landsea_mask==1, avg_precip, np.nan)
zonal_land_mean = np.nanmean(land_precip, axis=1)
figure = plt.figure(figsize=(4,8))
plt.plot(zonal_land_mean, LAT, label='Land Only', color='indianred')
plt.plot(global_precip, LAT, color='dodgerblue', label='Global')
plt.xlabel('mean precip, m/yr')
plt.ylabel('latitude, degree')
plt.legend(loc="upper right", fontsize=15)
plt.title('Zonally-Averaged Land Mean Precipitation', fontsize=15)<jupyter_output><empty_output><jupyter_text>Get temperature This file has both sea-surface temperature and 2-m temperature; using 2-m temperature for now.<jupyter_code>fname_T = "ERA-interim_avg_T.nc"
rootgrp = Dataset(fname_T, 'r')
sst = np.flip(np.squeeze(rootgrp.variables['sst'][:]), axis=0) - 273.15 #original unit was in K
t2m = np.flip(np.squeeze(rootgrp.variables['t2m'][:]), axis=0) - 273.15
fig=plt.figure(figsize=(20,10))
m = Basemap(projection='mill',lon_0=180)
lons, lats = np.meshgrid(LON, LAT)
xi, yi = m(lons, lats)
cs = m.contourf(xi, yi, t2m, cmap=plt.get_cmap("Blues"))
m.drawcoastlines(color="black")
cbar = plt.colorbar(cs)
cbar.set_label('2-Meter Temperature, Celsius')
plt.title('Annual Mean 2-Meter Temperature 1979-2018 ERA-interim')<jupyter_output><empty_output><jupyter_text>Get land-only zonal mean temperature<jupyter_code>land_t2m = np.where(landsea_mask==1, t2m, np.nan)
zonal_land_t2m = np.nanmean(land_t2m, axis=1)
figure = plt.figure(figsize=(4,8))
plt.plot(zonal_land_t2m, LAT, color='indianred')
plt.xlabel('mean 2-m temperature, Celsius')
plt.ylabel('latitude, degree')

plt.title('Zonally-Averaged Land Mean 2-Meter Temperature', fontsize=15)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1608910891089109, 'fraction_numerical': 0.03041018387553041, 'mean_word_length': 8.125806451612902, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '272188', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1155, 'n_words': 193, 'path': 'climate/global_precipitation/.ipynb_checkpoints/zonally_avg_precip-checkpoint.ipynb', 'repo_name': 'Swanson-Hysell/Earth_science_notebooks', 'size': '2828'}