def get_windpark_nearest(self, target_idx, n_nearest,\
                    year_from=0, year_to=0):

        #if only one year is desired
        if year_to==0:
            year_to=year_from

        meta = self.fetch_nrel_meta_data_all()
        target = self.fetch_nrel_meta_data(target_idx)
        tlat, tlon = target[1], target[2]

        marked = []
        nearest = []
        distances = []
        for i in xrange(n_nearest):
            smallest = None
            for t in xrange(meta.shape[0]):
                d = haversine((tlat, tlon), (meta[t][1], meta[t][2]))
                if(smallest == None and t != target_idx - 1 and t not in marked):
                    smallest = t
                    smallest_d = d
                else:
                    if(d <= smallest_d and t != target_idx - 1 and t not in marked):
                        smallest = t
                        smallest_d = d

            marked.append(smallest)
            nearest.append(meta[smallest])
            distances.append(smallest_d)

        result = Windpark(target_idx, distances[-1])

        for row in nearest:
            newturbine = Turbine(row[0], row[1] , row[2] , row[3] , row[4],\
                                 row[5], row[6])
            if year_from != 0:
                for y in range(year_from, year_to+1):
                   measurement = self.fetch_nrel_data(row[0], y,\
                                   ['date','corrected_score','speed'])
                   if y==year_from:
                       measurements = measurement
                   else:
                       measurements = np.concatenate((measurements, measurement))
                newturbine.add_measurements(measurements)
            result.add_turbine(newturbine)

        #add target turbine as last element
        newturbine = Turbine(target[0], target[1] , target[2] , target[3],\
                             target[4] , target[5], target[6])
        if year_from != 0:
            for y in range(year_from, year_to+1):
               measurement = self.fetch_nrel_data(target[0], y,\
                               ['date','corrected_score','speed'])
               if y==year_from:
                   measurements = measurement
               else:
                   measurements = np.concatenate((measurements, measurement))
            newturbine.add_measurements(measurements)
        result.add_turbine(newturbine)

        return result
Get a typed JSON document from the index based on its id.
dataset/ETHPy150Open cigroup-ol/windml/windml/datasets/nrel.py/NREL.get_windpark_nearest--crossover with--dataset/ETHPy150Open elastic/elasticsearch-py/elasticsearch/client/__init__.py/Elasticsearch.get