Exemple #1
0
 def test_write_domain_map__basemap_missing(self):
     plt.switch_backend('Agg')
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     border = d.get_border()
     tmpfilename = os.path.join(ntd.tmp_data_path, 'domain_write_map.png')
     with self.assertRaises(ImportError):
         write_domain_map(border, tmpfilename, labels=['Patch1'])
Exemple #2
0
 def test_write_domain_map(self):
     plt.switch_backend('Agg')
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     border = d.get_border()
     tmpfilename = os.path.join(ntd.tmp_data_path, 'domain_write_map.png')
     write_domain_map(border, tmpfilename, labels=['Patch1'])
     self.assertTrue(os.path.exists(tmpfilename))
     i = Image.open(tmpfilename)
     i.verify()
     self.assertEqual(i.info['dpi'], (50, 50))
Exemple #3
0
 def test_write_domain_map(self):
     plt.switch_backend('Agg')
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     border = d.get_border()
     tmpfilename = os.path.join(ntd.tmp_data_path, 'domain_write_map.png')
     write_domain_map(border, tmpfilename, labels=['Patch1'])
     self.assertTrue(os.path.exists(tmpfilename))
     i = Image.open(tmpfilename)
     i.verify()
     self.assertEqual(i.info['dpi'], (50, 50))
Exemple #4
0
 def test_write_domain_map_labels(self):
     plt.switch_backend('Agg')
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     border = d.get_border()
     tmpfilename = os.path.join(ntd.tmp_data_path,
                                'domain_write_map_labels.png')
     write_domain_map(border, tmpfilename,
                 mer_labels=[False, False, False, True],
                 par_labels=[True, False, False, False])
     self.assertTrue(os.path.exists(tmpfilename))
     i = Image.open(tmpfilename)
     i.verify()
Exemple #5
0
 def test_write_domain_map_labels(self):
     plt.switch_backend('Agg')
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     border = d.get_border()
     tmpfilename = os.path.join(ntd.tmp_data_path,
                                'domain_write_map_labels.png')
     write_domain_map(border, tmpfilename,
                 mer_labels=[False, False, False, True],
                 par_labels=[True, False, False, False])
     self.assertTrue(os.path.exists(tmpfilename))
     i = Image.open(tmpfilename)
     i.verify()
Exemple #6
0
 def write_map(self,
               outputFileName,
               lonVec=None,
               latVec=None,
               lonBorder=10.,
               latBorder=10.,
               figureSize=(6, 6),
               dpi=50,
               projection='cyl',
               resolution='c',
               continetsColor='coral',
               meridians=10,
               parallels=10,
               pColor='r',
               pLine='k',
               pAlpha=0.5,
               padding=0.,
               merLabels=[False, False, False, False],
               parLabels=[False, False, False, False],
               pltshow=False,
               labels=None):
     """Create an image with a map of the domain"""
     warnings.warn(self.WRITE_MAP_WARNING, NansatFutureWarning)
     border = self.get_border()
     write_domain_map(border,
                      outputFileName,
                      lon_vec=lonVec,
                      lat_vec=latVec,
                      lon_border=lonBorder,
                      lat_border=latBorder,
                      figure_size=figureSize,
                      dpi=dpi,
                      projection=projection,
                      resolution=resolution,
                      continets_color=continetsColor,
                      meridians=meridians,
                      parallels=parallels,
                      p_color=pColor,
                      p_line=pLine,
                      p_alpha=pAlpha,
                      padding=padding,
                      mer_labels=merLabels,
                      par_labels=parLabels,
                      pltshow=pltshow,
                      labels=labels)