gplately.read_netcdf_grid
- gplately.read_netcdf_grid(filename, return_grids: bool = False, realign: bool = False, resample=None, resize=None, x_dimension_name: str = '', y_dimension_name: str = '', data_variable_name: str = '') Tuple[MaskedArray, MaskedArray, MaskedArray] | MaskedArray [source]
Read grid data from a NetCDF (.nc) file.
- Parameters:
filename (str) – Full path to the
netCDF
raster file.return_grids (bool, optional, default=False) – If set to
True
, returns lon, lat arrays associated with the grid data.realign (bool, optional, default=False) – if set to
True
, realigns grid to -180/180 and flips the array if the latitudinal coordinates are decreasing.resample (tuple, optional, default=None) – If provided as
resample = (spacingX, spacingY)
, the grid data will be resampled with these x and y resolutions.resize (tuple, optional, default=None) – If provided as
resample = (resX, resY)
, the grid data will be resized to the number of columns (resX) and rows (resY).x_dimension_name (str, optional, default="") – If the grid file uses the comman names, such as
x
,lon
,lons
orlongitude
, you need not to provide this parameter. Otherwise, you need to tell us what the x dimension name is.y_dimension_name (str, optional, default="") – If the grid file uses the comman names, such as
y
,lat
,lats
orlatitude
, you need not to provide this parameter. Otherwise, you need to tell us what the y dimension name is.data_variable_name (str, optional, default="") – GPlately will try its best to guess the data variable name. However, it would be much better if you tell us what the data variable name is. Otherwise, GPlately’s guess may/may not be correct.
- Returns:
grid_z (MaskedArray) – A MaskedArray object containing the grid data. The longitudes are re-aligned between -180 and 180 degrees.
lon, lat (MaskedArray) – When
return_grids
isTrue
, return two additional MaskedArray objects containing the longitudes and latitudes of the grid data.