:py:mod:`opendrift.readers.reader_ROMS_native` ============================================== .. py:module:: opendrift.readers.reader_ROMS_native Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: opendrift.readers.reader_ROMS_native.Reader Functions ~~~~~~~~~ .. autoapisummary:: opendrift.readers.reader_ROMS_native.rotate_vectors_angle Attributes ~~~~~~~~~~ .. autoapisummary:: opendrift.readers.reader_ROMS_native.logger .. py:data:: logger .. py:class:: Reader(filename=None, name=None, gridfile=None, standard_name_mapping={}, save_interpolator=False, interpolator_filename=None) Bases: :py:obj:`opendrift.readers.basereader.BaseReader`, :py:obj:`opendrift.readers.basereader.StructuredReader` A reader for ROMS Output files. It can take a single file, a file pattern, a URL or an xarray Dataset. Args: :param filename: A single netCDF file, a pattern of files, or a xr.Dataset. The netCDF file can also be an URL to an OPeNDAP server. :type filename: string, xr.Dataset (required). :param name: Name of reader :type name: string, optional :param save_interpolator: Whether or not to save the interpolator that goes from lon/lat to x/y (calculated in structured.py) :type save_interpolator: bool :param interpolator_filename: If save_interpolator is True, user can input this string to control where interpolator is saved. :type interpolator_filename: Path, str, optional Example: .. code:: from opendrift.readers.reader_ROMS_native import Reader r = Reader("roms.nc") Several files can be specified by using a pattern: .. code:: from opendrift.readers.reader_ROMS_native import Reader r = Reader("*.nc") An OPeNDAP URL can be used: .. code:: from opendrift.readers.reader_ROMS_native import Reader r = Reader('https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc') A xr.Dataset can be used: .. code:: from opendrift.readers.reader_ROMS_native import Reader ds = xr.open_dataset(filename, decode_times=False) r = Reader(ds) Common constructor for all readers .. py:property:: mask_rho Mask for the rho-points. Uses wetdry_mask_rho (which should be 3D) if available, otherwise mask_rho (2D). If this mask is 2D, read it in this one time and use going forward in simulation. If 3D, will read in parts of the mask each loop. .. py:property:: mask_u Mask for the u-points. Uses wetdry_mask_u (which should be 3D) if available, otherwise mask_u (2D). If this mask is 2D, read it in this one time and use going forward in simulation. If 3D, will read in parts of the mask each loop. .. py:property:: mask_v Mask for the v-points. Uses wetdry_mask_v (which should be 3D) if available, otherwise mask_v (2D). If this mask is 2D, read it in this one time and use going forward in simulation. If 3D, will read in parts of the mask each loop. .. py:property:: zeta Sea surface height. .. py:property:: angle Grid angle if curvilinear. .. py:method:: get_variables(requested_variables, time=None, x=None, y=None, z=None, testing=False) Obtain a _block_ of values of the requested variables at all positions (x, y, z) closest to given time. These will be stored in :class:`opendrift.readers.interpolation.structured.ReaderBlock` and accessed from there. Arguments: variables: list of variables. time: datetime or None, time at which data are requested. x, y: float or ndarrays; coordinates of requested points. z: float or ndarray; vertical position (in meters, positive up) Returns: Dictionary keywords: variables (string) values: 2D ndarray bounding x and y. .. py:function:: rotate_vectors_angle(u, v, radians)