Beispiel #1
0
    def grib_styles(self, field, grib, path, index):
        with LOCK:
            try:
                styles = macro.wmsstyles(macro.mgrib(grib_input_file_name=path,
                                                     grib_field_position=index + 1))
                # Looks like they are provided in reverse order
            except Exception as e:
                self.log.exception('grib_styles: Error: %s', e)
                styles = {}

        return [MagicsWebStyle(**s) for s in styles.get('styles', [])]
Beispiel #2
0
    def netcdf_styles(self, field, ncvar, path, variable):
        with LOCK:
            try:
                styles = macro.wmsstyles(macro.mnetcdf(netcdf_filename=path,
                                                       netcdf_value_variable=variable))
            # Looks like they are provided in reverse order

                return [MagicsWebStyle(**s) for s in styles.get('styles', [])]
            except Exception as e:
                self.log.exception('netcdf_styles: Error: %s', e)
                styles = {}

        return [MagicsWebStyle(**s) for s in styles.get('styles', [])]