Input files to XML
As part of the mini development i need to change the atlantis input files to XML. The reason for doing this is to tidy up the structure so that the Mini can generate these input files easily from database content.
There are still lots of issues to be sorted out in regards to the logic of the input parameters. For example how to tell the mini that for this attribute there should be a parameter per vertebrate functional group, but for this attribute there should be one parameter per invertebrate functional group.
At present this sort of thing is done in the atlantis input parameter parsing code.
MigrateIOBox. At present there are arrays in the input files that are not needed. We really only want the number of migrateIOBox arrays read in to match the num_migrate_id values.
Perhaps i need to change the xml code to not always quit if the node is not found. The other option is that i need to add four migrateIOBox nodes for each group that can migrate. This is a bit silly. OK. Will not quit if the node is not found. This does mean that i have to load the species params before i can convert the file to xml but thats cool. Or i could just parse these first and them pull them out of the dom. Thats the plan.
One issue that we will need to think about if it we pad the atlantis input files generated by the mini with null fields. For example to we include the proportion ration values if the readin_popratio is false? I think in the xml conversion code i should include these values even if they aren’t used. But the mini should not pad the file with parameters that aren’t needed.
Also need to think about the how the mini handles editing existing files. If the user has parameters in the input file and they then select an option that makes those parameters redundant they shouldn’t be deleted from the file.
Ok I’m now writing the code to parse the new biology XML file. This code is in atBiologyXMLParamIO.c. Lots of it is quite generic so i’ll try to create as many functions as possible that can be reused. One issue that i haven’t dealth with yet is trying to do this in such as way that can be reused by the MINI. But i think it will only take me a day to write this new parsing code. If i try to make it really complicate it might not be worth it. Converting it to XML has made the parsing code much much simpler.
The verticalDistribution parameters are a bit strange. For all the vertebrates but SP and SB there are values for day and night for both adults and juv. I’ll change the SB and SP values to have the same values for adult and juv - this is what the load code will do anyway and it will make the parsing simpler.
bm->pSPageeat
OK we want to tidy up this array. Its used to store the age diet availability of invertebrates for consumption by vertebrates. At present this array is
bm->pSPageeat = AllocInit3DArrayDouble(Not_age_specific_id, bm->K_num_cohorts, bm->K_num_vert_sp, 0.0);
and we want to change it to:
bm->pSPageeat = AllocInit3DArrayDouble(bm->K_num_tot_sp, bm->K_num_cohorts, bm->K_num_tot_sp, 0.0);
The bm->p_BFDsplit and bm->p_BMDsplit have also been removed. Beth said this was cool.
I need to pad the xml out for these parameters - at present only some of the vertebrate groups have arrays. I’ll add zero values. OK thats done. I just added the following to InitDietAvailXML
xmlNodeSetContent(newnode, “0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0”);
This will make the parsing XML code heaps easier.
One thing that is annoying is that the order of indices’s in arrays is not consistent. It would be good to sort this out.
It would be nice to move the following values into the Functional group structure:
bm->mum_spVERT
and bm->C_spVERT
These could be moved into the processProps - there is already space for them. While i’m doing this it would be be nice to convert the invertebrate parameters into xml so they can be dealt with in the same code. I’ll do that later.
We want to change the implicit mortality due to fishing and seabirds into a single parameter for each vertebrate for each quarter. So i need to change the XML parsing to add these two values.
So i’ll change the InitImplicitMortalityRateXML to write out four values. Then when i;m parsing the old input files i’ll add the values read in for seabirds and fish to the values in the dom to get a single sum. OK. Thats done. I had to print out the values in scientific notation as the values are quite small. I now need to change the parsing code to read these values into a single array. Perhaps this data can also be stored in the processProps. No is seasonal not cohort based. I need to resize the bm->mS array from
bm->mS = AllocInit3DArrayDouble(2, 4, bm->K_num_vert_sp, 0.0); to
bm->mS = AllocInit2DArrayDouble(4, bm->K_num_vert_sp, 0.0);
Cool. Thats done.
I also need to change the code in Vert_Mortality to just expect a single value. I have changed the old parsing code to add the values in bm->mS.
I’ve had to pad out the migrateIOBox XML nodes as not all have values for each possible migration.
One problem i have is that none of the models i have are using the invertebrate migration. This makes it hard to test. I really need to work on building up my collection of models to make sure i’m testing all options in the model.
13-Jan-2008
I want to get this finished now so that i can help Rob Gamble with creating the tables he is after. I need to add a few additional parameters to the XML file to do this. He needs the invert clearance rate values c_jCEP_T15 etc. At present these are read in separately as they have a strange structure.