nais package

nais.checker module

nais.checker.startNaisChecker(dataset_path, bounding_boxes_path)[source]

Manually check a NAIS dataset, draw bounding boxes around bad data and save the boundaries into a netcdf file for later use.

Parameters:
data_filestr

Absolute path to NAIS netcdf data file

boundary_filestr

Absolyte path to file where to save the coordinates of bad data bounding boxes.

nais.processor module

nais.processor.check_config_file(config_file)[source]

Check goodness of configuration file

Parameters:
config_filestr

full path to configuration file

nais.processor.make_config_template(file_name)[source]

Make a configuration file template

Parameters:
file_namestr

full path to configuration file. For example /home/user/config.yml

nais.processor.nais_processor(config_file)[source]

Processes NAIS data

Parameters:
config_filestr

full path to configuration file

nais.utils module

nais.utils.combine_data(files, start, end, time_reso, flag_sensitivity=0.5)[source]

Combine netcdf datafiles and resample to new resolution on continuous time index

Parameters:
fileslist

List of NAIS data file paths

startstr

start time

endstr

end time

time_resostr

A pandas date frequency string. See for all options here: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases

flag_sensitivityfloat

fraction of time flag needs to be present in resampling

Returns:
xarray.Dataset or None

Combined dataset, None if no data in the date range

nais.utils.combine_databases(database_list, combined_database)[source]

Combine JSON databases

Parameters:
database_listlist of str

List of full paths to databases that should be combined. First database should have the earliest data, second database the second earliest and so on

combined_databasestr

full path to combined database

nais.utils.remove_bad_data(ds, bad_data)[source]

Set bad data to NaNs

Parameters:
dsxarray.Dataset

NAIS datafile

bad_dataxarray.Dataset

user-determined bad data boundaries using the NaisChecker()

Returns:
xarray.Dataset

Dataset with possible bad data set to NaN

nais.utils.remove_flagged_rows(ds, flag)[source]

Set data associated with given flag as NaN

Parameters:
dsxarray.Dataset

NAIS dataset

flagstr

Flag to be removed

Returns:
xarray.Dataset

NAIS dataset with flag rows set to NaN

nais.utils.rewrite_metadata(files, config)[source]

Rewrite metadata in netcdf file

Parameters:
fileslist of strings

List of the netcdf files

configstring

The name of the config file with updated info