original_docstring: Create test cube on rotated grid.
docstring: Create test cube on rotated grid.
docstring_tokens: Create test cube on rotated grid .
code: def create_rotated_grid_cube(data):
      """Create test cube on rotated grid."""
      # CORDEX EUR-44 example
      grid_north_pole_latitude = 39.25
      grid_north_pole_longitude = -162.0
      grid_lons = np.array(
          [-10, 0, 10],
          dtype=np.float64,
      )
      grid_lats = np.array(
          [-10, 0, 10],
          dtype=np.float64,
      )
  
      coord_sys_rotated = iris.coord_systems.RotatedGeogCS(
          grid_north_pole_latitude,
          grid_north_pole_longitude
      )
      grid_lat = iris.coords.DimCoord(grid_lats,
                                      var_name='rlon',
                                      standard_name='grid_latitude',
                                      units='degrees',
                                      coord_system=coord_sys_rotated)
      grid_lon = iris.coords.DimCoord(grid_lons,
                                      var_name='rlon',
                                      standard_name='grid_longitude',
                                      units='degrees',
                                      coord_system=coord_sys_rotated)
  
      coord_sys = iris.coord_systems.GeogCS(iris.fileformats.pp.EARTH_RADIUS)
      glon, glat = np.meshgrid(grid_lons, grid_lats)
      lons, lats = iris.analysis.cartography.unrotate_pole(
          np.deg2rad(glon), np.deg2rad(glat),
          grid_north_pole_longitude, grid_north_pole_latitude)
  
      lat = iris.coords.AuxCoord(lats,
                                 var_name='lat',
                                 standard_name='latitude',
                                 units='degrees',
                                 coord_system=coord_sys)
      lon = iris.coords.AuxCoord(lons,
                                 var_name='lon',
                                 standard_name='longitude',
                                 units='degrees',
                                 coord_system=coord_sys)
      dim_coord_spec = [
          (grid_lat, 0),
          (grid_lon, 1),
      ]
      aux_coord_spec = [
          (lat, [0, 1]),
          (lon, [0, 1]),
      ]
      cube = iris.cube.Cube(
          data,
          var_name='tos',
          units='K',
          dim_coords_and_dims=dim_coord_spec,
          aux_coords_and_dims=aux_coord_spec,
      )
      return cube
code_tokens: def create_rotated_grid_cube ( data ) : grid_north_pole_latitude = 39.25 grid_north_pole_longitude = - 162.0 grid_lons = np . array ( [ - 10 , 0 , 10 ] , dtype = np . float64 , ) grid_lats = np . array ( [ - 10 , 0 , 10 ] , dtype = np . float64 , ) coord_sys_rotated = iris . coord_systems . RotatedGeogCS ( grid_north_pole_latitude , grid_north_pole_longitude ) grid_lat = iris . coords . DimCoord ( grid_lats , var_name = 'rlon' , standard_name = 'grid_latitude' , units = 'degrees' , coord_system = coord_sys_rotated ) grid_lon = iris . coords . DimCoord ( grid_lons , var_name = 'rlon' , standard_name = 'grid_longitude' , units = 'degrees' , coord_system = coord_sys_rotated ) coord_sys = iris . coord_systems . GeogCS ( iris . fileformats . pp . EARTH_RADIUS ) glon , glat = np . meshgrid ( grid_lons , grid_lats ) lons , lats = iris . analysis . cartography . unrotate_pole ( np . deg2rad ( glon ) , np . deg2rad ( glat ) , grid_north_pole_longitude , grid_north_pole_latitude ) lat = iris . coords . AuxCoord ( lats , var_name = 'lat' , standard_name = 'latitude' , units = 'degrees' , coord_system = coord_sys ) lon = iris . coords . AuxCoord ( lons , var_name = 'lon' , standard_name = 'longitude' , units = 'degrees' , coord_system = coord_sys ) dim_coord_spec = [ ( grid_lat , 0 ) , ( grid_lon , 1 ) , ] aux_coord_spec = [ ( lat , [ 0 , 1 ] ) , ( lon , [ 0 , 1 ] ) , ] cube = iris . cube . Cube ( data , var_name = 'tos' , units = 'K' , dim_coords_and_dims = dim_coord_spec , aux_coords_and_dims = aux_coord_spec , ) return cube
short_docstring: Create test cube on rotated grid.
short_docstring_tokens: Create test cube on rotated grid .
comment: """Create test cube on rotated grid."""$SEP$# CORDEX EUR-44 example