@@ -503,6 +503,45 @@ export async function processRunSlideRuleClicked(rc: SrRunContext | null = null)
503503 if ( reqParamsStore . getMissionValue ( ) === 'ICESat-2' ) {
504504 if ( reqParamsStore . getIceSat2API ( ) ) {
505505 srReqRec . parameters = reqParamsStore . getAtlxxReqParams ( srReqRec . req_id ) as AtlxxReqParams
506+
507+ // Validate parameter consistency with API
508+ const api = reqParamsStore . getIceSat2API ( )
509+ const hasFit = ! ! srReqRec . parameters ?. parms ?. fit
510+ const hasPhoreal = ! ! srReqRec . parameters ?. parms ?. phoreal
511+
512+ // Valid APIs for fit: 'atl03' (will become 'atl03x-surface'), 'atl03x-surface'
513+ // Valid APIs for phoreal: 'atl03' (will become 'atl03x-phoreal'), 'atl03x-phoreal'
514+ const validApisForFit = [ 'atl03' , 'atl03x-surface' ]
515+ const validApisForPhoreal = [ 'atl03' , 'atl03x-phoreal' ]
516+
517+ if ( hasFit && ! validApisForFit . includes ( api ) ) {
518+ useSrToastStore ( ) . error (
519+ 'Parameter Mismatch' ,
520+ `Parameters contain 'fit' but API is '${ api } '. The 'fit' parameter requires API 'atl03' or 'atl03x-surface'. Please check your parameters.`
521+ )
522+ logger . error ( 'API and parameter mismatch' , {
523+ api,
524+ hasFit,
525+ expectedApis : validApisForFit
526+ } )
527+ requestsStore . setConsoleMsg ( 'Parameter validation failed' )
528+ return
529+ }
530+
531+ if ( hasPhoreal && ! validApisForPhoreal . includes ( api ) ) {
532+ useSrToastStore ( ) . error (
533+ 'Parameter Mismatch' ,
534+ `Parameters contain 'phoreal' but API is '${ api } '. The 'phoreal' parameter requires API 'atl03' or 'atl03x-phoreal'. Please check your parameters.`
535+ )
536+ logger . error ( 'API and parameter mismatch' , {
537+ api,
538+ hasPhoreal,
539+ expectedApis : validApisForPhoreal
540+ } )
541+ requestsStore . setConsoleMsg ( 'Parameter validation failed' )
542+ return
543+ }
544+
506545 if ( reqParamsStore . getIceSat2API ( ) === 'atl03' && srReqRec . parameters ?. parms ?. fit ) {
507546 srReqRec . func = 'atl03x-surface'
508547 } else if (
0 commit comments