Ejemplo n.º 1
0
 def __init__(self, input=None, *args, **kwargs):
     input = self._check_input_(input)
     Shapes.__init__(self, input, *args, **kwargs)
Ejemplo n.º 2
0
"""Test the :func:`~vacumm.misc.grid.io.Shapes` class"""
from vcmq import N, P, code_file_name, data_sample
from vacumm.misc.io import Shapes

result = []

# File names
shpfile = data_sample("ne_110m_land/ne_110m_land")
figfile = code_file_name(ext=False) + '_%i.png'

# Basic
S = Shapes(shpfile)
result.append(('assertEqual', [len(S), 127]))
S.plot(title='Basic', show=False)
P.savefig(figfile % 0)
P.close()

# Min area
S = Shapes(shpfile, min_area=1000)
result.append(('assertEqual', [len(S), 3]))
S.plot(title='Min area', show=False)
P.savefig(figfile % 1)
P.close()

# Projection
S = Shapes(shpfile, proj='merc')
result.append(('assertGreater', [S[1].area(), 1e12]))
S.plot(title='Projected', show=False)
P.savefig(figfile % 2)
P.close()
Ejemplo n.º 3
0
 def plot(self, select=None, ax=None, fill=None, fillcolor=None, points=False,
         m=True, show=True, **kwargs):
     return Shapes.plot(self, select=select, ax=ax, fill=fill, fillcolor=fillcolor,
         points=points, m=m, show=show, **kwargs)
Ejemplo n.º 4
0
"""Test the :func:`~vacumm.misc.grid.io.Shapes` class"""
from vcmq import N, P, code_file_name, data_sample
from vacumm.misc.io import Shapes
result = []

# File names
shpfile = data_sample("ne_110m_land/ne_110m_land")
figfile = code_file_name(ext=False)+'_%i.png'

# Basic
S = Shapes(shpfile)
result.append(('assertEqual', [len(S), 127]))
S.plot(title='Basic', show=False)
P.savefig(figfile%0);P.close()

# Min area
S = Shapes(shpfile, min_area=1000)
result.append(('assertEqual', [len(S), 3]))
S.plot(title='Min area', show=False)
P.savefig(figfile%1);P.close()

# Projection
S = Shapes(shpfile, proj='merc')
result.append(('assertGreater', [S[1].area(), 1e12]))
S.plot(title='Projected', show=False)
P.savefig(figfile%2);P.close()

# Clips
S = Shapes(shpfile, clip=[-10, 42, 10, 51.])
result.append(('assertEqual', [len(S), 3]))
S.plot(title='Clipped', show=False)