Commits

Anonymous committed e32ad86

- Se agrega los mapas de anomalias

  • Participants
  • Parent commits 07f86a3

Comments (0)

Files changed (29)

File crear_mapa_anomalia.py

+# -*- coding: iso-8859-1 -*-
+#!/usr/bin/env python
+from sys import path
+import numpy as np
+from matplotlib.pyplot import cm
+from guyra_lib import *
+from re import search
+
+path.append("/home/clima/cdat-5.2/lib64/python2.6/site-packages/")
+
+import cdms2
+
+datos = []
+titles = []
+
+TITULOS = {"prec_a2": ["PRECIPITACION"]}
+
+if __name__ == '__main__':
+    temp = [999,0]
+    prec = [999,0]
+    for a in ARCHIVOS:
+        fName = "datos/grid_" + a + ".nc"
+        f2Name = "datos/grid_6190_" + a + ".nc"
+        titles = ["1991-2020","2021-2050"]
+        ds = cdms2.open(fName)
+        ds2 = cdms2.open(f2Name)
+        for var in ds.listvariables():
+            motivo = "Precipitacion"
+            rango = np.linspace(-2,2,5)
+            colormap = cm.BrBG
+            colorline = cm.pink
+            unit = r"$\frac{mm}{dia}$"
+            if search("temp",var):
+                motivo = "Temperatura"
+                colormap = cm.RdBu_r
+                colorline = cm.Blues_r
+                rango = np.linspace(-3,3,7)
+                unit = u"�C"
+            esc = "A2"
+            if search("b2",var):
+                esc = "B2"
+            val1 = ds(var,squeeze=1,latitude=RNG_bnd[1],longitude=RNG_bnd[0])
+            val2 = ds2(var[:var.index("_")],squeeze=1,latitude=RNG_bnd[1],longitude=RNG_bnd[0])
+            val = val1 - val2
+            
+            if search("temp",var):
+                if val.min() < temp[0]:
+                    temp[0] = val.min()
+                if val.max() > temp[1]:
+                    temp[1] = val.max()
+            else:
+                if val.min() < prec[0]:
+                    prec[0] = val.min()
+                if val.max() > prec[1]:
+                    prec[1] = val.max()
+            plot_mapa("mapas/" + a + "_" + var + "_anomalia",
+                      [u"Anomal�a de %s para el escenario %s" % (motivo,esc),
+                      SUBTITULOS[a]],
+                      titles,
+                      "longitud",
+                      "latitud",
+                      unit,
+                      val,
+                      val.getLongitude(),
+                      val.getLatitude(),
+                      colormap,
+                      rango)
+        ds.close()
+    print temp,prec

File mapas/anual_prec_a2_anomalia.png

Added
New image

File mapas/anual_prec_b2_anomalia.png

Added
New image

File mapas/anual_temp_a2_anomalia.png

Added
New image

File mapas/anual_temp_b2_anomalia.png

Added
New image

File mapas/semestre_EJ_prec_a2_anomalia.png

Added
New image

File mapas/semestre_EJ_prec_b2_anomalia.png

Added
New image

File mapas/semestre_EJ_temp_a2_anomalia.png

Added
New image

File mapas/semestre_EJ_temp_b2_anomalia.png

Added
New image

File mapas/semestre_JD_prec_a2_anomalia.png

Added
New image

File mapas/semestre_JD_prec_b2_anomalia.png

Added
New image

File mapas/semestre_JD_temp_a2_anomalia.png

Added
New image

File mapas/semestre_JD_temp_b2_anomalia.png

Added
New image

File mapas/trimestre_AMJ_prec_a2_anomalia.png

Added
New image

File mapas/trimestre_AMJ_prec_b2_anomalia.png

Added
New image

File mapas/trimestre_AMJ_temp_a2_anomalia.png

Added
New image

File mapas/trimestre_AMJ_temp_b2_anomalia.png

Added
New image

File mapas/trimestre_EFM_prec_a2_anomalia.png

Added
New image

File mapas/trimestre_EFM_prec_b2_anomalia.png

Added
New image

File mapas/trimestre_EFM_temp_a2_anomalia.png

Added
New image

File mapas/trimestre_EFM_temp_b2_anomalia.png

Added
New image

File mapas/trimestre_JAS_prec_a2_anomalia.png

Added
New image

File mapas/trimestre_JAS_prec_b2_anomalia.png

Added
New image

File mapas/trimestre_JAS_temp_a2_anomalia.png

Added
New image

File mapas/trimestre_JAS_temp_b2_anomalia.png

Added
New image

File mapas/trimestre_OND_prec_a2_anomalia.png

Added
New image

File mapas/trimestre_OND_prec_b2_anomalia.png

Added
New image

File mapas/trimestre_OND_temp_a2_anomalia.png

Added
New image

File mapas/trimestre_OND_temp_b2_anomalia.png

Added
New image