def from_netCDF(cls,
                    filename=None,
                    grid_topology=None,
                    name=None,
                    units=None,
                    time=None,
                    ice_var=None,
                    ice_conc_var=None,
                    grid=None,
                    dataset=None,
                    grid_file=None,
                    data_file=None,
                    **kwargs):
        if filename is not None:
            data_file = filename
            grid_file = filename

        ds = None
        dg = None
        if dataset is None:
            if grid_file == data_file:
                ds = dg = _get_dataset(grid_file)
            else:
                ds = _get_dataset(data_file)
                dg = _get_dataset(grid_file)
        else:
            ds = dg = dataset

        if grid is None:
            grid = init_grid(grid_file,
                             grid_topology=grid_topology,
                             dataset=dg)
        if ice_var is None:
            ice_var = IceVelocity.from_netCDF(filename, grid=grid, dataset=ds)
        if time is None:
            time = ice_var.time

        if ice_conc_var is None:
            ice_conc_var = IceConcentration.from_netCDF(filename,
                                                        time=time,
                                                        grid=grid,
                                                        dataset=ds)
        if name is None:
            name = 'IceAwareProp'
        if units is None:
            units = ice_var.units
        return cls(name='foo',
                   units=units,
                   time=time,
                   ice_var=ice_var,
                   ice_conc_var=ice_conc_var,
                   grid=grid,
                   grid_file=grid_file,
                   data_file=data_file,
                   **kwargs)
    def from_netCDF(cls,
                    filename=None,
                    grid_topology=None,
                    name=None,
                    units=None,
                    time=None,
                    ice_var=None,
                    wind_var=None,
                    ice_conc_var=None,
                    grid=None,
                    dataset=None,
                    grid_file=None,
                    data_file=None,
                    **kwargs):

        if filename is not None:
            data_file = filename
            grid_file = filename

        ds = None
        dg = None
        if dataset is None:
            if grid_file == data_file:
                ds = dg = _get_dataset(grid_file)
            else:
                ds = _get_dataset(data_file)
                dg = _get_dataset(grid_file)
        else:
            ds = dg = dataset

        if grid is None:
            grid = init_grid(grid_file,
                             grid_topology=grid_topology,
                             dataset=dg)
        if wind_var is None:
            wind_var = GridWind.from_netCDF(filename,
                                            time=time,
                                            grid=grid,
                                            dataset=ds)

        return super(IceAwareWind,
                     cls).from_netCDF(grid_topology=grid_topology,
                                      name=name,
                                      units=units,
                                      time=time,
                                      ice_var=ice_var,
                                      wind_var=wind_var,
                                      ice_conc_var=ice_conc_var,
                                      grid=grid,
                                      dataset=ds,
                                      grid_file=grid_file,
                                      data_file=data_file,
                                      **kwargs)
 def __init__(self,
              name=None,
              units=None,
              time=None,
              variables=None,
              grid=None,
              grid_file=None,
              data_file=None,
              dataset=None):
     VelocityGrid.__init__(self,
                           name=name,
                           units=units,
                           time=time,
                           variables=variables,
                           grid=grid,
                           grid_file=grid_file,
                           data_file=data_file,
                           dataset=dataset)
     self.angle = None
     df = None
     if dataset is not None:
         df = dataset
     elif data_file is not None:
         df = _get_dataset(data_file)
     if df is not None and 'angle' in df.variables.keys():
         # Unrotated ROMS Grid!
         self.angle = GriddedProp(name='angle',
                                  units='radians',
                                  time=None,
                                  grid=self.grid,
                                  data=df['angle'])