@@ -24,6 +24,14 matplotlib.pyplot.register_cmap(cmap=ncmap) | |||||
24 |
|
24 | |||
25 | CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'viridis', 'plasma', 'inferno', 'Greys', 'seismic', 'bwr', 'coolwarm', 'spectral')] |
|
25 | CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'viridis', 'plasma', 'inferno', 'Greys', 'seismic', 'bwr', 'coolwarm', 'spectral')] | |
26 |
|
26 | |||
|
27 | def ll2xy(lat1, lon1, lat2, lon2): | |||
|
28 | ||||
|
29 | p = 0.017453292519943295 | |||
|
30 | a = 0.5 - numpy.cos((lat2 - lat1) * p)/2 + numpy.cos(lat1 * p) * numpy.cos(lat2 * p) * (1 - numpy.cos((lon2 - lon1) * p)) / 2 | |||
|
31 | r = 12742 * numpy.arcsin(numpy.sqrt(a)) | |||
|
32 | theta = numpy.arctan2(numpy.sin((lon2-lon1)*p)*numpy.cos(lat2*p), numpy.cos(lat1*p)*numpy.sin(lat2*p)-numpy.sin(lat1*p)*numpy.cos(lat2*p)*numpy.cos((lon2-lon1)*p)) | |||
|
33 | theta = -theta + numpy.pi/2 | |||
|
34 | return r*numpy.cos(theta), r*numpy.sin(theta) | |||
27 |
|
35 | |||
28 | def figpause(interval): |
|
36 | def figpause(interval): | |
29 | backend = plt.rcParams['backend'] |
|
37 | backend = plt.rcParams['backend'] | |
@@ -1051,26 +1059,21 class PlotPolarMapData(PlotData): | |||||
1051 |
|
1059 | |||
1052 | if self.data.meta['mode'] == 'A': |
|
1060 | if self.data.meta['mode'] == 'A': | |
1053 | continue |
|
1061 | continue | |
1054 |
|
|
1062 | ||
1055 |
f = open('/ |
|
1063 | f = open('/home/jespinoza/workspace/schain_scripts/distrito.csv') | |
1056 |
|
1064 | |||
1057 | lat1 = -11.96 |
|
1065 | lat1 = -11.96 | |
1058 | lon1 = -76.54 |
|
1066 | lon1 = -76.54 | |
1059 |
|
1067 | |||
1060 | for line in f: |
|
1068 | for line in f: | |
1061 |
label, |
|
1069 | label, lon, lat = [s.strip() for s in line.split(',') if s] | |
1062 |
lat |
|
1070 | lat = float(lat) | |
1063 |
lon |
|
1071 | lon = float(lon) | |
1064 |
|
1072 | x, y = ll2xy(lat1, lon1, lat, lon) | ||
1065 | dx = (lon2-lon1)*40000*numpy.cos((lat1+lat2)*numpy.pi/360)/360 |
|
1073 | ax.plot(x, y, '.b', ms=2) | |
1066 | dy = (lat1-lat2)*40000/360 |
|
1074 | ax.text(x, y, label.decode('utf8'), ha='center', va='bottom', size='8', color='black') | |
1067 | print label, dx, dy |
|
1075 | ||
1068 | if label == 'map': |
|
1076 | ||
1069 | print 'SDHSDHSDHSGHSDFHSDF' |
|
|||
1070 | ax.plot([dx], [dy],'--k') |
|
|||
1071 | else: |
|
|||
1072 | ax.plot([dx], [dy],'.b', ms=2) |
|
|||
1073 | ''' |
|
|||
1074 | if self.data.meta['mode'] == 'E': |
|
1077 | if self.data.meta['mode'] == 'E': | |
1075 | title = 'El={}$^\circ$'.format(self.data.meta['elevation']) |
|
1078 | title = 'El={}$^\circ$'.format(self.data.meta['elevation']) | |
1076 | label = 'E{:d}'.format(int(self.data.meta['elevation'])) |
|
1079 | label = 'E{:d}'.format(int(self.data.meta['elevation'])) |
General Comments 0
You need to be logged in to leave comments.
Login now