zapata.lib module

zapata.lib.name_notebook(newname)[source]

Change name to Jupyterlab instance

zapata.lib.get_values_from_dict(input_dict, keys)[source]

Get values from dictionary input_dict for keys in keys

Parameters:
  • input_dict -- Dictionary

  • keys -- List of keys

Return type:

List of values

zapata.lib.remove_values_from_list(the_list, val)[source]

Remove value val from list the_list

zapata.lib.makename(var, lev, yy, mm, dd)[source]

Utility to create names for ERA5 files.

zapata.lib.makemm(var, lev, yy, mm)[source]

Utility to create names for ERA5 numpy files

zapata.lib.makefilename(dir, var, lev, yy, mm, ext)[source]

Generalize file name creation

zapata.lib.adddir(name, dir)[source]

Add dir directory name to name file

zapata.lib.makedir(fndir)[source]

Create Directory fndir

zapata.lib.movefile(oldfile, newdir)[source]

Move file from oldfile to newdir

zapata.lib.copyfile(oldfile, newdir)[source]

Copy file from oldfile to newdir

zapata.lib.chop(a, epsilon=1e-10)[source]

Eliminate real small complex number converting to real

zapata.lib.year2date(years, i)[source]

Transform index i in string date yy/mm.

Rounding requires the small shift Years are obtained from np.arange(1979,2018, 1/12)

zapata.lib.date2year(years, date)[source]

Transform index date ['Jan' '1989' ] in index i.

Years are from np.arange(1979,2018, 1/12)

zapata.lib.putna(left, right, xar, scalar=None)[source]

Put NaN in xarray according if they are laying in the interval left,right

Parameters:
  • left,right -- Extremes of the interval where the values must be NaN

  • xar -- Xarray

  • scalar -- If set all entries not satisfying the condition are put equal to scalar

Return type:

Modified array

zapata.lib.go_to(dir)[source]

Set Working directory

Parameters:

dir -- Target directory relative to users' root directory

Yields:

Change working directory

zapata.lib.long_string(lon, cent_lon=0)[source]

Get nice formatted longitude string

Parameters:
  • lon -- Longitude

  • cent_lon -- Central longitude for projection used

Yields:

string in nice format

zapata.lib.lat_string(lat)[source]

Get nice formatted latitude string

Parameters:

lat -- Latitude

Yields:

string in nice format

zapata.lib.get_environment_info(option)[source]

Get information about the Python environment

Parameters:

option -- String Options are: 'interpreter': Get the path of the Python interpreter 'version': Get the Python version 'packages': Get the list of installed packages

Return type:

Information about the Python environment