Moja global: FLINT agricultural soils module

Hi everyone,
My name is Sulay. As a GSoC’20 student, I will be working on a project “Develop a module for agricultural soils for FLINT” with @project-mojaglobal . I will like to thank @Guy and @RobboW74 , who guided me throughout the application process. I will be using this topic to post my weekly reports.

3 Likes

Week 1 of Community Bonding Period

This week has been fantastic! My proposal for GSoC got accepted and I have just submitted the final report of my undergrad studies.

Firstly, @Guy organized a video conference with all the members of the moja global community. The purpose of this video call was to familiarize us with the structure of moja global and how and what does moja global do. He also gave us an agenda for what to do during the Community Bonding period.

Setting up the development environment, reviewing the moja global documention and code for better understanding of our projects and suggesting an improvement to the technical procedures are the main agendas for this Community Bonding period.

The 4 of us, @abhi211199, @abhineet97, @partharora1010 and I had a great discussion about which platform to use to post and track our work plans and evaluations.

Looking forward to working with @jleitch for the next week to prepare a work plan!

5 Likes

This is the result of the stand-up for this week.

Last week was successful. The students decided where and how to post their work. We will post weekly blogs here and on a specially created repo on our GitHub. We will also use GitHub to post our work plan and progress for each item. We will have weekly deliverables (issues) that will be resolved.

This week, the focus will be on getting a work plan in place by the end of the week. This will require close communication between the student and the mentor. We are still figuring out how it will work precisely.

The challenge this week will clearly be to get the communication to work. There is some reluctance on the side of the students to get the attention of the mentors. They should be not hesitate to get attention for their queries. If necessary they can use other channels of communication or ask other mentors or admins to assist.

But overall we are off on a great start. Looking forward to the work plans!

Week 2 of Community Bonding Period

I started this week by setting up the development environment of FLINT. After setting up the base environment, I contacted my mentor about how to move forward and come up with deliverables and work plan for the coding period. They suggested running an example module in Visual Code.

I built and ran one example module and a RothC soil module in Visual Studio. RothC is a model for the turnover of organic carbon in non-waterlogged topsoils that allows for the effects of soil type, temperature, moisture content and plant cover on the turnover process. As it was my first time running a solution in Visual Code, there were some configuration problems which I solved with my mentors’ help.

Currently. I am reading the workflow of the RothC module and how it is implemented to use it as a reference for the module that I have to build. During the weekend, I hope to fully understand it and come up with the first draft of the work plan for the coding period.

2 Likes

Sulay,
Good job last week setting up Visual Studio and studying RothC. Your challenge will probably be that you need to study both science and code before you can finalise your workplan. But there is time. So good luck this week. I am looking forward to your final workplan.

1 Like

Week 3 of Community Bonding Period

I started this week by preparing a first draft of the workplan of the coding period. I cleared some doubts regarding the schematics of the module with my mentors:

  • The module should run monthy (i.e give output on monthly time intervals).
  • We decided to use Excel sheets to store the emission factor tables. Later, it can be moved to a database.
  • The module should know which Tier model to use based on the configuration file. Our current focus is on Tier 1 model.

The lack of documentation of FLINT was posing as a problem to understand the different functions available for use. We had a discussion during our monthly team meeting about this and the mentors suggested to look at previous modules for reference and ask them for doubts whenever a problem occurs.

I hope to have a detailed workplan and proper understanding of all the functions of FLINT that I have to use by the start of the coding phase.

2 Likes

Thank you for the great progress Sulay. I think that you have made a big leap forward. Understanding the science is an additional challenge when you are working on a project like moja global. You have to understand the fine detail of both science and code, for a project like yours. I love the way you are taking up all the knowledge and interacting with your mentors to frame ideas. Great to see these dynamics. Keep up this productive exchange. We are sorry that our documentation is not up to standards. We are working on it and please do not hesitate to suggest how and where we can improve. Top job this week.

1 Like

@sulay15399 as @Guy mentions, your feedback as a “new developer” will be extremely valuable to improve the project’s documentation. Unfortunately as many (most?) open source projects are done mostly by software developers, and often by volunteers or people without a lot of extra time, documentation is often under-developed. This is a reason why Google started the Season of Docs program, and why communities like Write The Docs etc. are becoming so popular. So keep up the good work – all of your insights will make moja global even better!

1 Like

Week 4 of Community Bonding Period

This week has been a bit slow. I started creating a simple model in Google Sheets. Creating the model in spreadsheet would provide answers to many questions that will arise while creating the actual module in C++. Right now, I have created the emission factor tables needed to calculate the emissions. Over the weekend, I will work with my mentors to get the model running in spreadsheets. Moreover, as time goes, my understanding of the functions used in FLINT has increased and lack of documentation is not posing as a big problem.

1 Like

Dear Sulay,
I like your focus on progress. I agree with you that just starting to build the model in Google Sheets is a great way to learn what is not readily understandable (or available) from theory and manuals. So good job on the fast learning. I am sure this will pay off when you get to the coding.

1 Like

Week 5: Coding Period Begins

After adding all the emission factor tables in Excel, this week I added the nitrogen fertilizer application event in the Excel sheet. When this event occurs, either the emission is spontaneous or its continuous till a certain time. My mentors and I haven’t decided what it should be as of now. I am waiting for my mentors to add the rest of the events and then I would add the calculations for it in the Excel sheet.

For the FLINT module event implementation, I took the FLINT Chapman Richard module as a reference and created a module for the N fertilizer application event and N2O emissions. Right now, I have implemented the module in simple point configuration i.e the events are taking place at a single point. The next step would be trying out how to build a spatial configuration and implement the module on that.

1 Like

Hi Sulay,]
Thank you for the great work. These are essential steps in the design of a module. Your documentation of your experiences is actually very useful for future module developers as every user probably wants to adjust the modules to their national situation or they want to build a new module like you are doing now. If you are documenting your experience, you will be making the life of future developers very easy. So thank you for all your efforts. This is great.

1 Like

Week 6 and Week 7:
In the past two weeks, I created a module that outputs the N2O emissions occurring at a point on which synthetic and organic fertilizers are applied - PR#3. First, my mentors and I completed the prototype of the synthetic and organic fertilizers in the spreadsheet, and then based on that I started creating the module for FLINT.

I also added the feature of emissions occurring over a time period instead of getting over instantly - PR#8. While trying to figure out how to add this, I came across an issue where if we input events in a random order then some events were not getting called - Issue#7.

The next step is to use this point module and expand it to a spatial module.

1 Like

Sulay,
Thank you for the hard work. You have managed to catch up after we responded slowly to your questions. That is impressive. I hope that you are still on track to meet your target for the first coding period. Good luck with the spatial application of the module.

Week 8:

This week I have been working on the spatial module. In the module, based on the climate of a region the emission factors to be applied are chosen. FLINT uses Tile/Block/Cell to create a tiling reference system for the whole globe. I decided to run the module on the Dominica region as the tiling reference for the system was already available in FLINT examples.

The first task was to rasterize the IPCC climate zone GeoJSON files into Wet/Dry region raster file for the module using QGIS.

Secondly, for a spatial module, the event queue for each cell has to dynamically created based on some variables or the event queue has to be hard-coded for each cell. As the management regime for when to apply N fertilizer event has not yet been created, I decided to run the module on a hard-coded event queue to test it.

As till now, we have only added 2 events, the plan over the coming weeks is to add more events. So, to get a headstart I created a small database and SQL queries to add the variables necessary for calculating the activity data for crop residue in the module.

The Wet/Dry region raster file has been created and during the weekend, I plan to add it to the module.

1 Like

Week 9:

Firstly, I integrated the Wet/Dry raster file that I created last week in the module. Then, I started developing a land unit module for the spatial simulation.

For the spatial simulation I devised a workflow as follows:

  • based on the start date and end date of the simulation, at an interval of 3 months the synthetic and organic fertilizer events occur on a land unit and the emission factors are decided based on the wet/dry raster file.

I also suggested using priority queues or sorting the queue before simulation for the eventqueue module which solves the issue of random order of events.

The next step of the project is to add more modules and implement the solution of the issue mentioned above.

1 Like

Hi Sulay,
You passed the first period! Well done.
I think the module is taking shape slowly. Keep going, I feel that you have picked up some speed over the last week. That is great!

Week 10:
This week I discussed with my mentors what new modules to add. We decided to add crop residue model first before the manure management module as it was less complex.
The crop residue module needs a crop harvesting event. In an ideal system, it will have a crop yield model which would grow the crops from the time of planting until a crop harvesting event occurs. The harvest event stops the plant growth and takes the current crop mass and remove a proportion for consumption/use (the harvest yield). The remainder is the crop residue from which we calculate the emissions.
For now, I have implemented a simple point configuration of the crop residue module to which crop harvesting event and spatial example will be added over the next week,

2 Likes

Hi Sulay,
Great to see you are moving on to the next feature. I like the explanation you have provided. I will have a look at the point configuration you have implemented. Good stuff.

Week 11 & 12:
For the past 2 weeks, I worked on developing two new sub-modules for the FLINT agricultural soils module.

  1. N emissions from the nitrogen deposited on pasture, range and paddock: https://github.com/moja-global/GSoC.FLINT.Module.Agricultural_Soil_Model/pull/14

  2. N emissions due the change in land use/management/input: https://github.com/moja-global/GSoC.FLINT.Module.Agricultural_Soil_Model/pull/18

For the previous sub-modules, I used wet/dry climate classification for the emission factors. While developing the above 2 modules, it was necesssary to use the 12 IPCC Climate Zone classification so I changed the classification to 12 Zone for the whole module. Also, for better optimization of the SQL queries, I hope to convert it into dynamic queries so that I don’t have to search through the table while extracting the activity data.

Now, only one sub-module for manure management is left to develop from all the Tier 1 equations.
Due to lack of workflow on developing landunits for each of the sub-modules’ spatial example, their development is going slow. For the coming weeks, the plan is to finish completing the manure management sub-module and then start working on the leftover spatial examples and the documentation.

1 Like