Read in LSM files

pangaea.open_mfdataset(path_to_lsm_files, lat_var, lon_var, time_var, lat_dim, lon_dim, time_dim, lon_to_180=False, coords_projected=False, loader=None, engine=None, autoclose=True)[source]

Wrapper to open land surface model netcdf files using xarray.open_mfdataset().

Warning

The time dimension and variable will both be renamed to ‘time’ to enable slicing.

Parameters:
  • path_to_lsm_files (str) – Path to land surface model files with wildcard. (Ex. ‘/path/to/files/*.nc’)
  • lat_var (str) – Latitude variable (Ex. lat).
  • lon_var (str) – Longitude variable (Ex. lon).
  • time_var (str) – Time variable (Ex. time).
  • lat_dim (str) – Latitude dimension (Ex. lat).
  • lon_dim (str) – Longitude dimension (Ex. lon).
  • time_dim (str) – Time dimension (ex. time).
  • lon_to_180 (bool, optional, default=False) – It True, will convert longitude from [0 to 360] to [-180 to 180].
  • coords_projected (bool, optional, default=False) – It True, it will assume the coordinates are already in the projected coordinate system.
  • loader (str, optional, default=None) – If ‘hrrr’, it will load in the HRRR dataset.
  • engine (str, optional) – See: xarray.open_mfdataset() documentation.
  • autoclose (str, optional, default=True) – If True, will use autoclose option with xarray.open_mfdataset().
Returns:

Return type:

xarray.Dataset()

Read with pangaea example:

import pangaea as pa

with pa.open_mfdataset('/path/to/ncfiles/*.nc',
                       lat_var='lat',
                       lon_var='lon',
                       time_var='time',
                       lat_dim='lat',
                       lon_dim='lon',
                       time_dim='time') as xds:
    print(xds.lsm.projection)