Example #1
0
 def _get_data(self):
     self.query = create_query(self)
     if self.output is not None:
         self.data = self._get_complex_output()
     else:
         self.data = np.array([
             float(x) for x in web_post(
                 self.wcps_url, {"query": self.query})[1:-1].split(',')
         ])
 def _get_data(self):
     self.query = create_query(self)
     if self.output == "csv":
         self.data = web_post(self.wcps_url, {"query":self.query})
     if self.output == "netcdf":
         self.data = web_post_file(self.wcps_url, {"query":self.query})
     if self.output == "gtiff":
         self.data = web_post_file(self.wcps_url, {"query":self.query})
     if self.output == "png":
         self.data = web_post_file(self.wcps_url, {"query":self.query})
Example #3
0
 def _get_data(self):
     self.query = create_query(self)
     if not self._data:
         try:
             t_data = web_post(self.wcps_url, {"query": self.query})[1:-1]
             self._data = float(t_data)
         except ValueError, e:
             try:
                 self.logger.info(
                     "trying to marshal result into array due to %s", e)
                 self._data = [float(x) for x in t_data.split(' ')]
             except Exception, e:
                 self.logger.error(sys.exc_info()[0])
                 self.logger.error(self.query)
    def _get_data(self):
        self.query = create_query(self)
        if self.output == "csv":
            self.data = web_post(self.wcps_url, {"query": self.query})
            self.data = self.data[2:-2]
            self.data = self.data.split('}},{{')

            self.data = [x.split('},{') for x in self.data]
            self.data = [[x.split(',') for x in y] for y in self.data]
            self.data = np.array(self.data)
            self.data = self.data.astype(np.float)
        if self.output == "netcdf":
            self.data = web_post_file(self.wcps_url, {"query": self.query})
        if self.output == "geotiff":
            self.data = web_post_file(self.wcps_url, {"query": self.query})
Example #5
0
    def _get_data(self):
        self.query = create_query(self)
        if self._data is None:
            if self.output == "csv":
                self._data = web_post(self.wcps_url,
                                      {"query": self.query})[1:-1]
                self._data = self._data.split('},{')
                self._data = [x.split(',') for x in self._data]
                self._data = np.array(self._data)
                self._data = self._data.astype(np.float)
            if self.output == "netcdf":
                self._data = web_post_file(self.wcps_url,
                                           {"query": self.query})
            if self.output == "gtiff":
                self._data = web_post_file(self.wcps_url,
                                           {"query": self.query})
        else:
            return self._data

        return self._data