예제 #1
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', [])]
예제 #2
0
from Magics import macro as magics

#name = 'magics'
#Setting of the output file name
output = magics.output(output_formats=['png'],
                       output_name_first_page_number="off",
                       output_name="mymagicsplot")

#Import the  data
data = magics.mnetcdf(netcdf_filename="test.nc", netcdf_value_variable="aps")

#Apply styling
legend = magics.mlegend()
contour = magics.mcont(contour_shade="on",
                       contour_shade_method="area_fill",
                       legend='on')
coast = magics.mcoast()

# Make the plot
magics.plot(output, data, contour, coast, legend)