app module

Gridtools library applications.

App()

maskEditor()

maskEditorPylab() This class is based on code from [HHT+21].

class gridtools.app.App(grd=None)

Bases: object

clearInformationWindow(event)
debugLevelCallback(event)
deleteLogfile(event)

This function is called as a result of pushing the “Erase logfile” button in the application. This places a call into GridTools.deleteLogfile(filename).

downloadNetCDF()
errorFigure()

Create Blank Plot to signal plotting failure. This signals a problem within the user specifications in relation to code capabilities.

errorNoGridFigure()

Creates a plot for the scenario where the user has not specified the grid before making a plot

initializeDashboard()
initializePlot()

Plot the initial image upon loading up the application. This is developed to differentiate between plot failure and the first plot.

initializeTabs()
initializeWidgets()
loadLocalGrid(event)
loadRemoteGrid(event)
logEnableCallback(event)
logLevelCallback(event)
make_grid(event)
make_plot()
plotRefresh(event)
saveRemoteGrid(event)

Attempt to save grid to remote filesystem using last known grid filename.

showManual()
updateDataView()
updateFilename(newFilename)
class gridtools.app.maskEditor(ds=None, grd=None, **kwargs)

Bases: object

This class helps launch the jupyter version of the ocean mask editor.

createMaskEditorApp()
getGridSubset(lClickY, lClickX, grd)
great_circle(lon1, lat1, lon2, lat2)
plotMap(x, y)
class gridtools.app.maskEditorPylab(grd=None)

Bases: object

This class helps launch the pylab version of the ocean mask editor. A jupyter cell with %pylab should preceed usage of this class.

Example:
[1]: import os

from gridtools.grids import roms import cartopy.crs as crs import xarray as xr

# Enable pylab %pylab

[2]: # Define a map projection

map = ccrs.Stereographic(central_latitude=90.0, central_longitude=160.0)

[3]: # Load a ROMS grid

# Use the gridid.txt file os.environ[“PYROMS_GRIDID_FILE”] = “/import/AKWATERS/jrcermakiii/configs/Arctic6/roms/gridid.txt”

romsObj = roms.ROMS() romsGrd = romsObj.get_ROMS_grid(‘ARCTIC6’)

[4]: # Start the pylab editor

plotObj = romsObj.edit_mask_mesh(romsGrd.hgrid, proj=map)

[5]: # When ready to save the edited grid, uncomment the next line and run this cell

# romsObj.write_ROMS_grid(romsGrd, filename=’grid_py.nc’)

Note

This currently only operates on ROMS grids. This method is extremely slow due to the map refresh method.