def test_save_domain_map(self): tmpfilename = os.path.join(ntd.tmp_data_path, 'domain_save_map.png') save_domain_map(self.d, tmpfilename) self.assertTrue(os.path.exists(tmpfilename)) i = Image.open(tmpfilename) i.verify() self.assertEqual(i.info['dpi'], (100, 100))
def test_write_map(self): d = Domain(4326, "-te 25 70 35 72 -ts 500 500") tmpfilename = os.path.join(ntd.tmp_data_path, 'domain_write_map.png') d.write_map(tmpfilename) self.assertTrue(os.path.exists(tmpfilename)) i = Image.open(tmpfilename) i.verify() self.assertEqual(i.info['dpi'], (50, 50))
def test_write_map_labels(self): d = Domain(4326, "-te 25 70 35 72 -ts 500 500") tmpfilename = os.path.join(ntd.tmp_data_path, "domain_write_map_labels.png") d.write_map(tmpfilename, merLabels=[False, False, False, True], parLabels=[True, False, False, False]) self.assertTrue(os.path.exists(tmpfilename)) i = Image.open(tmpfilename) i.verify()
def test_save_domain_map(self): tmpfilename = os.path.join(ntd.tmp_data_path, 'domain_save_map.png') save_domain_map(self.d, tmpfilename) self.assertTrue(os.path.exists(tmpfilename)) i = Image.open(tmpfilename) i.verify() # with cartopy>=0.20.0, the dpi attribute is not # always (100, 100) self.assertEqual(tuple(np.round(i.info['dpi'], 1)), (100, 100))
def test_write_map_dpi100(self): d = Domain(4326, "-te 25 70 35 72 -ts 500 500") tmpfilename = os.path.join(ntd.tmp_data_path, "domain_write_map_dpi100.png") d.write_map(tmpfilename, dpi=100) self.assertTrue(os.path.exists(tmpfilename)) i = Image.open(tmpfilename) i.verify() self.assertEqual(i.info["dpi"], (100, 100))
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))
def test_write_map_labels(self): d = Domain(4326, "-te 25 70 35 72 -ts 500 500") tmpfilename = os.path.join(ntd.tmp_data_path, 'domain_write_map_labels.png') d.write_map(tmpfilename, merLabels=[False, False, False, True], parLabels=[True, False, False, False]) self.assertTrue(os.path.exists(tmpfilename)) i = Image.open(tmpfilename) i.verify()
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()