Argument to admb programs.

12 views
Skip to first unread message

Höskuldur Björnsson

unread,
Feb 18, 2020, 1:13:44 AM2/18/20
to us...@admb-project.org
Dear all 


I have an ADMB program called muppet that I run with 

muppet and some admb switches like 

muppet -mcmc 1e5  -mcscale  etc.  

Can I in the program find out what arguments were used to call the program i.e what was the number of mcmc iterations?


But what I am really after is to see if I can add an option like 

muppet -mceval -lastyear 2019.  

Here lastyear is a parameter that has been read from input files but for certain purpose getting it as input switch might be more convenient.  

Thanks in advance
Höskuldur

Jim Ianelli - NOAA Federal

unread,
Feb 18, 2020, 2:00:45 AM2/18/20
to Höskuldur Björnsson, us...@admb-project.org
Below are some interrogations of commandline options, noting that the function option_match seems to do the tests you might be interested in. Also note some of these tests are looking for commandline options that are already part of ADMB e.g., "-mcmc") and others are ones I use in the code specifically. 



 int on=0;
  if ( (on=option_match(argc,argv,"-ind"))>-1)
  {
    if (on>argc-2 | argv[on+1][0] == '-')
    {
      cerr << "Invalid input data command line option"
    " -- ignored" << endl;  
    }
    else
    {
      cntrlfile_name = adstring(argv[on+1]);
    }
  }
  else
  {
      cntrlfile_name =   tmpstring;
  }
  if ( (on=option_match(argc,argv,"-om"))>-1)
  {
    oper_mod  = 1;
    cmp_no = atoi(argv[on+1]);
    cout<<"Got to operating model option "<<oper_mod<<endl;
  }
  if ( (on=option_match(argc,argv,"-mcmc"))>-1)
  {
    mcmcmode = 1;
  }

--
To unsubscribe from this group and stop receiving emails from it, send an email to users+un...@admb-project.org.


--

James Ianelli
NMFS/NOAA Building 4
7600 Sand Pt Way NE
Seattle WA 98115

 206 526 6510

Visit the ADMB project http://admb-project.org/

Also see Alaska groundfish stock assessments

Reply all
Reply to author
Forward
0 new messages