def get(self, **kwargs): """ Returns data for a path Assumes the data is just an array of floats. """ path = request.url[len(request.url_root):] return base.get(path)
def main(): parser.add_argument("--karmapi", default='.') args = parser.parse_args() path_template = '{source}/time/{date:%Y/%m/%d}/{field}' dates = [] if args.start: start = date(*[int(x) for x in args.start.split('/')]) dates.append(start) if args.end: end = date(*[int(x) for x in args.end.split('/')]) aday = timedelta(days=1) day = start + aday while day < end: dates.append(day) day += aday parms = base.Parms() parms.source = args.source or 'euro' paths = args.path for field in args.field: parms.field = field for day in dates: parms.date = date(day.year, day.month, day.day) path = path_template.format(**parms.__dict__) paths.append(path) for path in paths: print(path) if args.n: continue # need meta data to config module properly meta = base.get_all_meta_data(path) raw = weather.RawWeather() raw.from_dict(meta) data = base.get(path) ndata = raw.day_to_numpy(data) pyplot.imsave(path.replace('/', '-') + '.png', ndata)
def get(self, **kwargs): """ Rough notes on how to plot centred on a location using basemap What I really want to do is implement a Karma Pi path something like this: locations/{location}/{item} That will show you {item} from location's point of view. Now {item} works best if it does not have any /'s, so for the item parameter we'll convert /'s to ,'s and see how that looks. The idea is {item} will be a path to something in Karma Pi. So here is how it might go: >>> parms = base.Parms() >>> parms.path = "locations/bermuda" >>> parms.item = "time,2015,11,01,precipitation,image" >>> data = location(parms) In the background, some magic will read lat/lon for locations/bermuda, or rather read the meta data and hope the info is there. It will find the data for the precipitation image and use it to create an image of the data using the "ortho" projection in basemap. This shows a hemisphere of the world, centered on the location. It would be good to offer other views. This can be supported by adding different end points for each view Eg: >>> parms = base.Parms() >>> parms.path = "locations/bermuda" >>> parms.item = "time,2015,11,01,precipitation,mercator" Might return a mercator projection. >>> parms = base.Parms() >>> parms.path = "locations/bermuda" >>> parms.item = "time,2015,11,01,precipitation,tendegree" Might return a 10 degree window around the location. """ path = request.url[len(request.url_root):] return base.get(path)
def get(self, **kwargs): """ Get all fields for a specific date """ path = request.url[len(request.url_root):] return base.get(path)
def get(self, **kwargs): """ Get all the data for a lat/lon grid """ path = request.url[len(request.url_root):] return base.get(path)