The NES object

Creating a NES object

nes.create_nes.create_nes(comm=None, info=False, projection=None, parallel_method='Y', balanced=False, times=None, avoid_first_hours=0, avoid_last_hours=0, first_level=0, last_level=None, **kwargs)[source]

Create a Nes class from scratch.

Parameters

comm: MPI.Communicator

MPI Communicator.

info: bool

Indicates if you want to get reading/writing info.

parallel_methodstr

Indicates the parallelization method that you want. Default: ‘Y’. accepted values: [‘X’, ‘Y’, ‘T’].

balancedbool

Indicates if you want a balanced parallelization or not. Balanced dataset cannot be written in chunking mode.

avoid_first_hoursint

Number of hours to remove from first time steps.

avoid_last_hoursint

Number of hours to remove from last time steps.

first_levelint

Index of the first level to use.

last_levelint, None

Index of the last level to use. None if it is the last.

nes.create_nes.from_shapefile(path, method=None, parallel_method='Y', **kwargs)[source]

Create NES from shapefile data.

  1. Create NES grid.

  2. Create shapefile for grid.

  3. Spatial join to add shapefile variables to NES variables.

Parameters

pathstr

Path to shapefile.

methodstr

Overlay method. Accepted values: [‘nearest’, ‘intersection’, None].

parallel_methodstr

Indicates the parallelization method that you want. Default: ‘Y’. accepted values: [‘X’, ‘Y’, ‘T’].

Loading a NES object

nes.load_nes.concatenate_netcdfs(nessy_list, comm=None, info=False, parallel_method='Y', avoid_first_hours=0, avoid_last_hours=0, first_level=0, last_level=None, balanced=False)[source]

Concatenate variables form different sources.

Parameters

nessy_listlist

List of Nes objects or list of paths to concatenate.

commMPI.Communicator

MPI Communicator.

Returns

Nes

Nes object with all the variables.

nes.load_nes.open_netcdf(path, comm=None, xarray=False, info=False, parallel_method='Y', avoid_first_hours=0, avoid_last_hours=0, first_level=0, last_level=None, balanced=False)[source]

Open a netCDF file.

Parameters

pathstr

Path to the NetCDF file to read.

commMPI.COMM

MPI communicator to use in that netCDF. Default: MPI.COMM_WORLD.

xarraybool

(Not working) Indicates if you want to use xarray. Default: False.

infobool

Indicates if you want to print (stdout) the reading/writing steps.

avoid_first_hoursint

Number of hours to remove from first time steps.

avoid_last_hoursint

Number of hours to remove from last time steps.

parallel_methodstr

Indicates the parallelization method that you want. Default: ‘Y’. Accepted values: [‘X’, ‘Y’, ‘T’]

balancedbool

Indicates if you want a balanced parallelization or not. Balanced dataset cannot be written in chunking mode.

first_levelint

Index of the first level to use.

last_levelint, None

Index of the last level to use. None if it is the last.

Returns

Nes

Nes object. Variables read in lazy mode (only metadata).