/* called by model.menu /* assumes we have preprocessed aobs &s .count [calc %.count% + 1] /* nono &setvar .stag [date -tag] /* so we can make unique file names &s tanphi [tan [angrad %.phi%]] &s low = [calc [calc [calc %.bd% - 1] / %.bd%] * %tanphi%] &type Slopes under %low% are stable even when saturated. &type Creating an intermediate grid /* the old version divided by depth on both sides /* repaired 3/20/97 &if %.depth% eq -1 &then qnt%.stag% = ((1000 * %.coh%)/ ~ (9807 * soilgrid * %tanphi% * cossq) + ~ %.bd% * (1 - (tanslope / %tanphi%)) ) * %.T% * 1000 / aobs /*qnt%.stag% = (1000 * %.coh% + %.bd% * 9807 * cossq * (%tanphi% - tanslope)) /~ /* (9807 * soilgrid * (aobs / %.T% / 1000) * %tanphi% * cossq) &else /* qnt%.stag% = (1000 * %.coh% + %.bd% * 9807 * cossq * (%tanphi% - tanslope)) /~ /* (9807 * %.depth% * (aobs / %.T% / 1000) * %tanphi% * cossq) /* qnt%.stag% = ((1000 * %.coh%)/ (9807 * %.depth% * %tanphi% * cossq) + %.bd% * (1 - (tanslope / %tanphi%)) ) * %.T% * 1000 / aobs qnt%.stag% = ( 1000 * %.coh% / ( 9807 * %.depth% * %tanphi% * cossq ) + %.bd% * ( 1 - ( tanslope / %tanphi% )) ) * %.T% * 1000 / aobs &type Creating the stability grid qsat%.stag% = %.T% * 1000 / aobs qust%.stag% = qust%.stag% = con(tanslope < %low%,9999,qsat%.stag% < qnt%.stag%,9999,qnt%.stag% < 0,0,qnt%.stag% > 9000,9000,qnt%.stag%) &type reclassing the stability grid qust%.stag%_%.count% = reclass (qust%.stag%,unstord.reclass) kill qnt%.stag% ; kill qust%.stag%; kill qsat%.stag% &s .T%.count% = %.T% &s .bd%.count% = %.bd% &s .depth%.count% = %.depth% &s .phi%.count% = %.phi% &s .coh%.count% = %.coh% /********&r reformat_vat.aml /* &watch %.stag%_%.count% /* list QUST%.stag%_%.count%.vat /* &watch &off /* &sys reformat %.stag%_%.count% &do i = 1 &to 7 clearselect; resel QUST%.stag%_%.count%.vat INFO value = %i% &if [before [show select QUST%.stag%_%.count%.vat INFO] ,] = 0 &then &s .ncells%i%_%.count% 0 &else &s .ncells%i%_%.count% [listunique QUST%.stag%_%.count%.vat -info count] &end &type Model %.count% is complete