Difference between revisions of "COPdate"

From Agri4castWiki
Jump to: navigation, search
(Created page with "__NOTOC__ {{scientific}} ==Introduction== COP stands for Climatically Optimal Planting. The concept is implemented in the COPdate oracle package. By running the package for al...")
 
Line 2: Line 2:
 
{{scientific}}
 
{{scientific}}
 
==Introduction==
 
==Introduction==
COP stands for Climatically Optimal Planting. The concept is implemented in the COPdate oracle package. By running the package for all historical years, the earliest and latest optimal sowing date can be found (sowing date window). By processing a specific year, the optimal sowing date for that year is found.
+
COPdate stands for Climatically Optimal Planting date. The concept of finding optimal planting dates based on climate data, is implemented in the oracle COPdate package. By running the package for all historical years, the earliest and latest optimal sowing date can be found (sowing date window). By processing a specific year, the optimal sowing date for that year is found.
  
===Finding sowing dates===
+
In the operational MCYFS mainly the functions ''find_sowing_date'' (for a single year) and ''sowing_dates_years'' (for multiple years) are used. Both functions find a sowing date for a specific combination of crop, grid and year, according expert rules.  
Since the package is used to find optimal sowing dates for specific years, only the ''find_sowing_date'' function (for a single year) and ''sowing_dates_years'' function (for multiple years) are called. Both functions find a sowing date for a specific combination of crop, grid and year, according expert rules.  
 
  
 
==Architecture==
 
==Architecture==
Required objects inside the oracle schema where the COPdata is to be applied (e.g. CGMS14RUK):  
+
To be able to run the package in parallel, it is connected to a tasks administration system that should be initialized before running the find_sowing_date and sowing_dates_years functions.
 +
 
 +
Required objects inside the oracle schema where the COPdata is applied (e.g. CGMS14RUK):  
 
* COPDATE package
 
* COPDATE package
 
* MRSDATES package
 
* MRSDATES package
Line 27: Line 28:
 
* TD_KEY_VALUES synonym
 
* TD_KEY_VALUES synonym
 
* TASKSET sequence
 
* TASKSET sequence
 +
* PROCESS_COP_OSD_BLK procedure
 +
* PROCESS_COP_SD_ALLYEARS_BLK procedure
  
Required objects inside the assisting oracle schema for managing  task processing (e.g. RUKMAN):  
+
Required objects inside the assisting oracle schema for administering task (e.g. RUKMAN):  
 
* SIGNALS package
 
* SIGNALS package
 
* TASK package
 
* TASK package
Line 38: Line 41:
 
To initialize tasks for COPdate, the INIT_TASKS procedure is used. Five or six arguments are required:
 
To initialize tasks for COPdate, the INIT_TASKS procedure is used. Five or six arguments are required:
  
initialize single year:
+
To initialize a single year:
 
* task (= cop-sd)  
 
* task (= cop-sd)  
 
* initial status (= pending)
 
* initial status (= pending)
Line 45: Line 48:
 
* regime (winter or spring)
 
* regime (winter or spring)
  
initialize multiple years:
+
To initialize multiple years:
 
* task (= cop-sd)  
 
* task (= cop-sd)  
 
* initial status (= pending)
 
* initial status (= pending)
Line 53: Line 56:
 
* regime (winter or spring)
 
* regime (winter or spring)
  
The procedure provides content for TASK_LIST object in the assisting schema (e.g. RUKMAN) that transfers the tasks via views TASKLIST to the various TASKLIST views in the main schema (e.g. CGMS14RUK). 
+
If start- and end year are NULL then all the years in the crop_calendar will be initialized for the crop and grid(s). If start- or end year is NOT NULL, then this value will be used as start- resp. end year of the range of years; the other value will be derived from the crop_calendar. If both start- and end year are NOT NULL these values will be used as start- resp. end year of the range of years; only this range will be processed. The start- and end year will be included in the range to be processed.
 
 
If both year1 and year2 are null then all the years in the crop_calendar will be processed for the crop and gridcell(s). I.e. the whole archive for these crop.
 
# If one of year1 and year2 is NOT null then this value will be used as starting resp. ending year of the range of years; the other value will be derived from the crop_calendar.
 
# If both of year1 and year2 are NOT null these values will be used as starting resp. ending year of the range of years. Only this range will be processed.
 
# The starting and ending year will be included in the range to be processed.
 
# Only sd is processed for gridcell(s) listed in p_qry_grid. If the query/list is empty then all grids will be processed.
 
  
 +
The above procedure fills the TASK_LIST table in the assisting schema (e.g. RUKMAN) which transfers the tasks via views to the various TASKLIST views in the main schema (e.g. CGMS14RUK). 
  
==Results==
+
To find optimal planting dates, the functions PROCESS_COP_OSD_BLK for a single year, or PROCESS_COP_SD_ALLYEARS_BLK for multiple years are called. These procedures pick up '''pending''' tasks of a certain age, finishing them one by one. When picking up a tasks, its phase  is updated to '''In progress'''. In case of an error, the phase is updated to '''Error'''. When a sowing date is found, the status is updated to '''Resulted''' and the found sowing date is updated in the {{Object|CROP_CALENDARS}} table. When no sowing date is found, the phase is update to '''No results''' and a new tasks is created with phase '''Pending'''. This procedures allows for calling the COPdate in parallel since only pending tasks of a certain age are processed (thus ignoring just newly created tasks).
Whenever the package finds a sowing date, it updates directly the {{Object|CROP_CALENDARS}} table for the processed crop, grid and year.
 

Revision as of 14:14, 8 February 2019



Introduction

COPdate stands for Climatically Optimal Planting date. The concept of finding optimal planting dates based on climate data, is implemented in the oracle COPdate package. By running the package for all historical years, the earliest and latest optimal sowing date can be found (sowing date window). By processing a specific year, the optimal sowing date for that year is found.

In the operational MCYFS mainly the functions find_sowing_date (for a single year) and sowing_dates_years (for multiple years) are used. Both functions find a sowing date for a specific combination of crop, grid and year, according expert rules.

Architecture

To be able to run the package in parallel, it is connected to a tasks administration system that should be initialized before running the find_sowing_date and sowing_dates_years functions.

Required objects inside the oracle schema where the COPdata is applied (e.g. CGMS14RUK):

  • COPDATE package
  • MRSDATES package
  • COP_CROP_GRID_REGIMES table
  • COP_CROP_REGIMES table
  • COP_WINDOWS table
  • INIT_TASKS procedure
  • NEW_TASK_ISW_INPROGRESS view
  • TASKLIST view
  • TASKLIST_COP_SD view
  • TASKLIST_COP_SD_ALLYEARS view
  • TASKLIST_COP_WDW view
  • TASKLIST_ISW view
  • ADD_PROCESS_LOG synonym
  • SIGNALS synonym
  • TASK synonym
  • TD_KEY_VALUE synonym
  • TD_KEY_VALUES synonym
  • TASKSET sequence
  • PROCESS_COP_OSD_BLK procedure
  • PROCESS_COP_SD_ALLYEARS_BLK procedure

Required objects inside the assisting oracle schema for administering task (e.g. RUKMAN):

  • SIGNALS package
  • TASK package
  • TD_KEY_VALUE types
  • TD_KEY_VALUES types
  • ADD_PROCESS_LOG procedure

Configuration

To initialize tasks for COPdate, the INIT_TASKS procedure is used. Five or six arguments are required:

To initialize a single year:

  • task (= cop-sd)
  • initial status (= pending)
  • crop
  • year
  • regime (winter or spring)

To initialize multiple years:

  • task (= cop-sd)
  • initial status (= pending)
  • crop
  • start year
  • end year
  • regime (winter or spring)

If start- and end year are NULL then all the years in the crop_calendar will be initialized for the crop and grid(s). If start- or end year is NOT NULL, then this value will be used as start- resp. end year of the range of years; the other value will be derived from the crop_calendar. If both start- and end year are NOT NULL these values will be used as start- resp. end year of the range of years; only this range will be processed. The start- and end year will be included in the range to be processed.

The above procedure fills the TASK_LIST table in the assisting schema (e.g. RUKMAN) which transfers the tasks via views to the various TASKLIST views in the main schema (e.g. CGMS14RUK).

To find optimal planting dates, the functions PROCESS_COP_OSD_BLK for a single year, or PROCESS_COP_SD_ALLYEARS_BLK for multiple years are called. These procedures pick up pending tasks of a certain age, finishing them one by one. When picking up a tasks, its phase is updated to In progress. In case of an error, the phase is updated to Error. When a sowing date is found, the status is updated to Resulted and the found sowing date is updated in the CROP_CALENDARS table. When no sowing date is found, the phase is update to No results and a new tasks is created with phase Pending. This procedures allows for calling the COPdate in parallel since only pending tasks of a certain age are processed (thus ignoring just newly created tasks).