Пример #1
0
 def load_grid(cls, nc):
     if isinstance(nc, Dataset):
         pass
     else:
         nc = Dataset(nc, 'r')
     topology_var = find_grid_topology_var(nc)
     sa = SGridAttributes(nc, cls.topology_dimension, topology_var)
     dimensions = sa.get_dimensions()
     node_dimensions, node_coordinates = sa.get_node_coordinates()
     grid_topology_var = sa.get_topology_var()
     edge1_dimensions, edge1_padding = sa.get_attr_dimension(
         'edge1_dimensions')  # noqa
     edge2_dimensions, edge2_padding = sa.get_attr_dimension(
         'edge2_dimensions')  # noqa
     edge1_coordinates = sa.get_attr_coordinates('edge1_coordinates')
     edge2_coordinates = sa.get_attr_coordinates('edge2_coordinates')
     angles = sa.get_angles()
     vertical_dimensions, vertical_padding = sa.get_attr_dimension(
         'vertical_dimensions')  # noqa
     node_lon, node_lat = sa.get_cell_node_lat_lon()
     center_lon, center_lat = sa.get_cell_center_lat_lon()
     edge1_lon, edge1_lat = sa.get_cell_edge1_lat_lon()
     edge2_lon, edge2_lat = sa.get_cell_edge2_lat_lon()
     face_dimensions, face_padding = sa.get_attr_dimension(
         'face_dimensions')  # noqa
     face_coordinates = sa.get_attr_coordinates('face_coordinates')
     sgrid = cls(angles=angles,
                 node_lon=node_lon,
                 node_lat=node_lat,
                 center_lon=center_lon,
                 center_lat=center_lat,
                 edge1_lon=edge1_lon,
                 edge1_lat=edge1_lat,
                 edge2_lon=edge2_lon,
                 edge2_lat=edge2_lat,
                 dimensions=dimensions,
                 edge1_coordinates=edge1_coordinates,
                 edge1_dimensions=edge1_dimensions,
                 edge1_padding=edge1_padding,
                 edge2_coordinates=edge2_coordinates,
                 edge2_dimensions=edge2_dimensions,
                 edge2_padding=edge2_padding,
                 edges=None,
                 face_coordinates=face_coordinates,
                 face_dimensions=face_dimensions,
                 face_padding=face_padding,
                 faces=None,
                 grid_topology_var=grid_topology_var,
                 grid_variables=None,
                 node_coordinates=node_coordinates,
                 node_dimensions=node_dimensions,
                 node_padding=None,
                 variables=None,
                 vertical_dimensions=vertical_dimensions,
                 vertical_padding=vertical_padding)
     sa.get_variable_attributes(sgrid)
     return sgrid
Пример #2
0
 def get_topology_var(self):
     grid_topology_var = find_grid_topology_var(self.nc)
     return grid_topology_var
Пример #3
0
def test_find_grid_topology(roms_sgrid):
    result = find_grid_topology_var(roms_sgrid)
    expected = 'grid'
    assert result == expected