{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# How to plot NetCDF Files with Magics\n",
"\n",
"This tutorial will give view an overview of the possibilities offered by Magics to interpret and plot some NetCDF data.\n",
"\n",
"You will have to create a netcdf object to help Magics to extract and interpret the data you want to plot. \n",
"A list of the available parameters can be found in the NetCDF Action Documentation
\n",
"\n",
"This action will be combined with a projection definition, and a visualisation action to create a plot.\n",
"\n",
"Magics can handle 2 type of geo-referenced NetCDF:\n",
"
\n",
"netcdf data {\n",
"dimensions:\n",
"\tlongitude = 360 ;\n",
"\tlatitude = 181 ;\n",
"\ttime = 1 ;\n",
"variables:\n",
"\t\tfloat longitude(longitude) ;\n",
"\t\tlongitude:units = \"degrees_east\" ;\n",
"\t\tlongitude:long_name = \"longitude\" ;\n",
"\tfloat latitude(latitude) ;\n",
"\t\tlatitude:units = \"degrees_north\" ;\n",
"\t\tlatitude:long_name = \"latitude\" ;\n",
"\tint level(level) ;\n",
"\t\tlevel:units = \"millibars\" ;\n",
"\t\tlevel:long_name = \"pressure_level\" ;\n",
"\tint time(time) ;\n",
"\t\ttime:units = \"hours since 1900-01-01 00:00:0.0\" ;\n",
"\t\ttime:long_name = \"time\" ;\n",
"\t\ttime:calendar = \"gregorian\" ;\n",
"\tshort t(time, level, latitude, longitude) ;\n",
"\t\tt:_FillValue = -32767s ;\n",
"\t\tt:missing_value = -32767s ;\n",
"\t\tt:units = \"K\" ;\n",
"\t\tt:long_name = \"Temperature\" ;\n",
"\t\tt:standard_name = \"air_temperature\", \n",
"\n",
"// global attributes:\n",
"\t\t:Conventions = \"CF-1.6\" ;\n",
"\t\t:history = \"2016-09-16 16:52:53 GMT by grib_to_netcdf-1.15.0\" ;\n",
"}\n",
"\n",
"\n",
"This simple example contains a regular field t, the geo-referencement is described by the 2 variables latitude and longitude .\n",
"Let's pass this information to Magics through a mnetcdf object.\n",
"\n",
"\n",
"First we import the Magics.macro package."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import Magics.macro as magics"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"Now, we have to define the geographical area we want to see in our final plot. Let's say that we focus on Europe in a geographical projection ..\n",
"We need to create :\n",
"