mpas_analysis.shared.regions.compute_region_masks_subtask.ComputeRegionMasksSubtask¶
-
class
mpas_analysis.shared.regions.compute_region_masks_subtask.
ComputeRegionMasksSubtask
(parentTask, regionGroup, meshName, subprocessCount=1, obsFileName=None, lonVar='lon', latVar='lat', useMpasMaskCreator=False)[source]¶ An analysis tasks for computing cell masks for regions defined by geojson features
- Variables
regionGroup (str) – The name of one of the supported region groups (see
mpas_analysis.shared.regions.get_region_info()
)region (dict) – A dictionary of information about the region from
mpas_analysis.shared.regions.get_region_info()
geojsonFileName (str) – A geojson file, typically from the MPAS
geometric_features
repository, defining the shapes to be maskedoutFileSuffix (str) – The suffix for the resulting mask file
featureList (list of str) – A list of features to include or
None
for all featuresmaskFileName (str) – The name of the output mask file
obsFileName (str) – The name of an observations file to create masks for. But default, lon/lat are taken from an MPAS restart file
latVar (lonVar,) – The name of the longitude and latitude variables in
obsFileName
meshName (str) – The name of the mesh or grid, used as part of the mask file name. Default is the MPAS mesh name
-
__init__
(parentTask, regionGroup, meshName, subprocessCount=1, obsFileName=None, lonVar='lon', latVar='lat', useMpasMaskCreator=False)[source]¶ Construct the analysis task and adds it as a subtask of the
parentTask
.- Parameters
parentTask (
AnalysisTask
) – The parent task, used to get thetaskName
,config
andcomponentName
regionGroup (str) – The name of one of the supported region groups (see
mpas_analysis.shared.regions.get_region_info()
)meshName (str) – The name of the mesh or grid, used as part of the mask file name. Default is the MPAS mesh name
- subprocessCountint, optional
The number of processes that can be used to make the mask
- obsFileNamestr, optional
The name of an observations file to create masks for. But default, lon/lat are taken from an MPAS restart file
- lonVar, latVarstr, optional
The name of the longitude and latitude variables in
obsFileName
- useMpasMaskCreatorbool, optional
If
True
, the mask creator frommpas_tools
will be used to create the mask. Otherwise, python code is used.
Methods
__init__
(parentTask, regionGroup, meshName)Construct the analysis task and adds it as a subtask of the
parentTask
.add_subtask
(subtask)Add a subtask to this tasks.
check_analysis_enabled
(analysisOptionName[, …])Check to make sure a given analysis is turned on, issuing a warning or raising an exception if not.
check_generate
()Determines if this analysis should be generated, based on the
generate
config option andtaskName
,componentName
andtags
.close
()Close the Process object.
expand_region_names
(regionNames)If
regionNames
contains'all'
, make sure the geojson file exists and then return all the region names found in the file.is_alive
()Return whether process is alive
join
([timeout])Wait until child process terminates
kill
()Terminate process; sends SIGKILL signal or uses TerminateProcess()
make_region_mask
()If the geojson mask file has not already been cached in the diagnostics or custom diagnostic directories, it will be created in the analysis output’s masks directory.
run
([writeLogFile])Sets up logging and then runs the analysis task.
run_after
(task)Only run this task after the given task has completed.
run_task
()Compute the requested climatologies
set_start_end_date
(section)Set the start and end dates in the
config
correspond to the start and end years in a given category of analysissetup_and_check
()Perform steps to set up the analysis and check for errors in the setup.
start
()Start child process
terminate
()Terminate process; sends SIGTERM signal or uses TerminateProcess()
Attributes
BLOCKED
FAIL
READY
RUNNING
SUCCESS
UNSET
authkey
daemon
Return whether process is a daemon
exitcode
Return exit code of process or None if it has yet to stop
ident
Return identifier (PID) of process or None if it has yet to start
name
pid
Return identifier (PID) of process or None if it has yet to start
sentinel
Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.