salem.GeoNetcdf

class salem.GeoNetcdf(file, grid=None, time=None, monthbegin=False)[source]

NetCDF files with geolocalisation info.

GeoNetcdf will try hard to understand the geoloc and time of the file, but if it can’t you can still provide the time and grid at instantiation.

__init__(file, grid=None, time=None, monthbegin=False)[source]

Open the file and try to understand it.

Parameters:
file: path to the netcdf file
grid: a Grid object. This will override the normal behavior of
GeoNetcdf, which is to try to understand the grid automatically.
time: a time array. This will override the normal behavior of
GeoNetcdf, which is to try to understand the time automatically.
monthbegin: set to true if you are sure that your data is monthly
and that the data provider decided to tag the date as the center of
the month (stupid)

Methods

__init__(file[, grid, time, monthbegin])

Open the file and try to understand it.

close()

get_vardata([var_id, as_xarray])

Reads the data out of the netCDF file while taking into account time and spatial subsets.

set_period([t0, t1])

Set a period of interest for the dataset.

set_roi([shape, geometry, crs, grid, ...])

Set a region of interest for the dataset.

set_subset([corners, crs, toroi, margin])

Set a subset for the dataset.

Attributes

roi

Mask of the ROI (same size as subset).

time

Time array