Probando CDO

Integrantes:

  • Carla Gulizia
  • Natalia Zazulie
  • Natalia Montroull

Instalación:

# Instalar cdo desde la terminal
$ sudo apt-get install cdo

# Instalar con conda el python-cdo:
$conda install -c conda-forge cdo=1.7.1

# Es necesaria una libreriaa extra para cdo:
sudo apt-get install libjpeg9
In [12]:
# Load required module
import numpy as np
import netCDF4
from cdo import *
from matplotlib import pyplot as plt
%matplotlib inline
In [13]:
path = '../../../data/'
file = path + 'pr_Amon_CanESM2_historical_r1i1p1_193101-200512_SA.nc'
In [14]:
cdo = Cdo()
# Compute the South America mean monthly precipitation and return it as a numpy array:
mean_pr = np.squeeze(cdo.fldmean(input=file, returnArray='pr')) # Field Mean pr SA (da una serie temporal) 
years = cdo.showyear(input=file)
In [20]:
pr_box.shape
Out[20]:
(900,)
In [15]:
#pr_ene = np.squeeze(cdo.fldmean(input=file, returnArray='pr'))
pr_box = np.squeeze(cdo.fldmean (input='-sellonlatbox,280,300,-40,-20 ' + file, returnArray='pr'))
pr_box.shape
plt.plot(pr_box*60*60*24)
Out[15]:
[<matplotlib.lines.Line2D at 0x7fbe377c63c8>]
In [16]:
prSA_anom = np.squeeze(cdo.sub(input = '-fldmean ' + file + ' -timmean -selyear,1971/2000 -fldmean ' + file, returnArray='pr', options = '-L'))
In [17]:
pr_anu = cdo.yearmean (input= '-fldmean ' + file, returnArray='pr')
In [1]:
#Este css es trabajo de @LorenaABarba y su grupo
from IPython.core.display import HTML
css_file = '../../css/personal.css'
HTML(open(css_file, "r").read())
Out[1]: