Exemplo n.º 1
0
        /// <summary>
        /// Constructor for process tracker: Initialises the trackers for individual processes
        /// </summary>
        /// <param name="numTimesteps">The number of time steps in the model</param>
        /// <param name="lats">The latitudes of active grid cells in the model</param>
        /// <param name="lons">The longitudes of active grid cells in the model</param>
        /// <param name="cellIndices">List of indices of active cells in the model grid</param>
        /// <param name="Filenames">The filenames of the output files to write the tracking results to</param>
        /// <param name="trackProcesses">Whether to track processes</param>
        /// <param name="cohortDefinitions">The definitions for cohort functional groups in the model</param>
        /// <param name="missingValue">The missing value to use in process tracking output files</param>
        /// <param name="outputFileSuffix">The suffix to be applied to output files from process tracking</param>
        /// <param name="outputPath">The path to the folder to be used for process tracking outputs</param>
        /// <param name="trackerMassBins">The mass bins to use for categorising output data in the process trackers</param>
        /// <param name="specificLocations">Whether the model is being run for specific locations</param>
        /// <param name="cellIndex">The index of the current cell in the list of all cells to run the model for</param>
        /// <param name="initialisation">The Madingley Model initialisation</param>
        /// <param name="marineCell">Whether the current cell is a marine cell</param>
        /// <param name="latCellSize">The size of grid cells in the latitudinal direction</param>
        /// <param name="lonCellSize">The size of grid cells in the longitudinal direction</param>
        public ProcessTracker(uint numTimesteps,
                              float[] lats, float[] lons,
                              List <uint[]> cellIndices,
                              SortedList <string, string> Filenames,
                              Boolean trackProcesses,
                              FunctionalGroupDefinitions cohortDefinitions,
                              double missingValue,
                              string outputFileSuffix,
                              string outputPath, MassBinsHandler trackerMassBins,
                              Boolean specificLocations,
                              int cellIndex,
                              MadingleyModelInitialisation initialisation,
                              bool marineCell,
                              float latCellSize,
                              float lonCellSize)
        {
            // Initialise trackers for ecological processes
            _TrackProcesses = trackProcesses;

            if (_TrackProcesses)
            {
                _TrackReproduction = new ReproductionTracker(numTimesteps, (uint)lats.Length, (uint)lons.Length, cellIndices, Filenames["NewCohortsOutput"], Filenames["MaturityOutput"], outputFileSuffix, outputPath, cellIndex);
                _TrackEating       = new EatingTracker((uint)lats.Length, (uint)lons.Length, Filenames["TrophicFlowsOutput"], outputFileSuffix, outputPath, cellIndex, initialisation, marineCell);
                _TrackGrowth       = new GrowthTracker(numTimesteps, (uint)lats.Length, (uint)lons.Length, cellIndices, Filenames["GrowthOutput"], outputFileSuffix, outputPath, cellIndex);
                _TrackMortality    = new MortalityTracker(numTimesteps, (uint)lats.Length, (uint)lons.Length, cellIndices, Filenames["MortalityOutput"], outputFileSuffix, outputPath, cellIndex);
                _TrackExtinction   = new ExtinctionTracker(Filenames["ExtinctionOutput"], outputPath, outputFileSuffix, cellIndex);
                _TrackMetabolism   = new MetabolismTracker(Filenames["MetabolismOutput"], outputPath, outputFileSuffix, cellIndex);

                // Initialise the predation and herbivory trackers only for runs with specific locations
                if (specificLocations == true)
                {
                    _TrackPredation = new PredationTracker(numTimesteps, cellIndices, Filenames["PredationFlowsOutput"], cohortDefinitions,
                                                           missingValue, outputFileSuffix, outputPath, trackerMassBins, cellIndex);
                }
            }
        }
        /// <summary>
        /// Constructor for process tracker: Initialises the trackers for individual processes
        /// </summary>
        /// <param name="numTimesteps">The number of time steps in the model</param>
        /// <param name="lats">The latitudes of active grid cells in the model</param>
        /// <param name="lons">The longitudes of active grid cells in the model</param>
        /// <param name="cellIndices">List of indices of active cells in the model grid</param>
        /// <param name="Filenames">The filenames of the output files to write the tracking results to</param>
        /// <param name="trackProcesses">Whether to track processes</param>
        /// <param name="cohortDefinitions">The definitions for cohort functional groups in the model</param>
        /// <param name="missingValue">The missing value to use in process tracking output files</param>
        /// <param name="outputFileSuffix">The suffix to be applied to output files from process tracking</param>
        /// <param name="outputPath">The path to the folder to be used for process tracking outputs</param>
        /// <param name="trackerMassBins">The mass bins to use for categorising output data in the process trackers</param>
        /// <param name="specificLocations">Whether the model is being run for specific locations</param>
        /// <param name="cellIndex">The index of the current cell in the list of all cells to run the model for</param>
        /// <param name="initialisation">The Madingley Model initialisation</param>
        /// <param name="marineCell">Whether the current cell is a marine cell</param>
        /// <param name="latCellSize">The size of grid cells in the latitudinal direction</param>
        /// <param name="lonCellSize">The size of grid cells in the longitudinal direction</param>
        public ProcessTracker(uint numTimesteps,
            float[] lats, float[] lons,
            List<uint[]> cellIndices,
            SortedList<string, string> Filenames,
            Boolean trackProcesses,
            FunctionalGroupDefinitions cohortDefinitions,
            double missingValue,
            string outputFileSuffix,
            string outputPath, MassBinsHandler trackerMassBins,
            Boolean specificLocations,
            int cellIndex,
            MadingleyModelInitialisation initialisation,
            bool marineCell,
            float latCellSize,
            float lonCellSize)
        {
            // Initialise trackers for ecological processes
            _TrackProcesses = trackProcesses;

            if (_TrackProcesses)
            {
                _TrackReproduction = new ReproductionTracker(numTimesteps, (uint)lats.Length, (uint)lons.Length, cellIndices, Filenames["NewCohortsOutput"], Filenames["MaturityOutput"], outputFileSuffix, outputPath, cellIndex);
                _TrackEating = new EatingTracker((uint)lats.Length, (uint)lons.Length, Filenames["TrophicFlowsOutput"], outputFileSuffix, outputPath, cellIndex, initialisation, marineCell);
                _TrackGrowth = new GrowthTracker(numTimesteps, (uint)lats.Length, (uint)lons.Length, cellIndices, Filenames["GrowthOutput"], outputFileSuffix, outputPath, cellIndex);
                _TrackMortality = new MortalityTracker(numTimesteps, (uint)lats.Length, (uint)lons.Length, cellIndices, Filenames["MortalityOutput"], outputFileSuffix, outputPath, cellIndex);
                _TrackExtinction = new ExtinctionTracker(Filenames["ExtinctionOutput"], outputPath, outputFileSuffix, cellIndex);
                _TrackMetabolism = new MetabolismTracker(Filenames["MetabolismOutput"], outputPath, outputFileSuffix, cellIndex);

                // Initialise the predation and herbivory trackers only for runs with specific locations
                if (specificLocations == true)
                {
                    _TrackPredation = new PredationTracker(numTimesteps, cellIndices, Filenames["PredationFlowsOutput"], cohortDefinitions,
                        missingValue, outputFileSuffix, outputPath, trackerMassBins, cellIndex);
                }
            }
        }