{"action":"created","issue":{"url":"https://api.github.com/repos/permamodel/permamodel/issues/44","repository_url":"https://api.github.com/repos/permamodel/permamodel","labels_url":"https://api.github.com/repos/permamodel/permamodel/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/permamodel/permamodel/issues/44/comments","events_url":"https://api.github.com/repos/permamodel/permamodel/issues/44/events","html_url":"https://github.com/permamodel/permamodel/issues/44","id":228168679,"number":44,"title":"FNM1D should update at least once","user":{"login":"mdpiper","id":5673711,"avatar_url":"https://avatars0.githubusercontent.com/u/5673711?v=3","gravatar_id":"","url":"https://api.github.com/users/mdpiper","html_url":"https://github.com/mdpiper","followers_url":"https://api.github.com/users/mdpiper/followers","following_url":"https://api.github.com/users/mdpiper/following{/other_user}","gists_url":"https://api.github.com/users/mdpiper/gists{/gist_id}","starred_url":"https://api.github.com/users/mdpiper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdpiper/subscriptions","organizations_url":"https://api.github.com/users/mdpiper/orgs","repos_url":"https://api.github.com/users/mdpiper/repos","events_url":"https://api.github.com/users/mdpiper/events{/privacy}","received_events_url":"https://api.github.com/users/mdpiper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sc0tts","id":16582646,"avatar_url":"https://avatars2.githubusercontent.com/u/16582646?v=3","gravatar_id":"","url":"https://api.github.com/users/sc0tts","html_url":"https://github.com/sc0tts","followers_url":"https://api.github.com/users/sc0tts/followers","following_url":"https://api.github.com/users/sc0tts/following{/other_user}","gists_url":"https://api.github.com/users/sc0tts/gists{/gist_id}","starred_url":"https://api.github.com/users/sc0tts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sc0tts/subscriptions","organizations_url":"https://api.github.com/users/sc0tts/orgs","repos_url":"https://api.github.com/users/sc0tts/repos","events_url":"https://api.github.com/users/sc0tts/events{/privacy}","received_events_url":"https://api.github.com/users/sc0tts/received_events","type":"User","site_admin":false},"assignees":[{"login":"sc0tts","id":16582646,"avatar_url":"https://avatars2.githubusercontent.com/u/16582646?v=3","gravatar_id":"","url":"https://api.github.com/users/sc0tts","html_url":"https://github.com/sc0tts","followers_url":"https://api.github.com/users/sc0tts/followers","following_url":"https://api.github.com/users/sc0tts/following{/other_user}","gists_url":"https://api.github.com/users/sc0tts/gists{/gist_id}","starred_url":"https://api.github.com/users/sc0tts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sc0tts/subscriptions","organizations_url":"https://api.github.com/users/sc0tts/orgs","repos_url":"https://api.github.com/users/sc0tts/repos","events_url":"https://api.github.com/users/sc0tts/events{/privacy}","received_events_url":"https://api.github.com/users/sc0tts/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2017-05-12T02:05:17Z","updated_at":"2017-05-12T15:45:12Z","closed_at":null,"body":"The CSDMS Modeling Framework expects a model to update at least once, as a part of the initialize-run-finalize lifecycle.\r\n\r\nUsing the default configuration file produced from its BMI settings (see below), FNM1D throws an exception when updated. For example:\r\n\r\n```\r\nIn [1]: from permamodel.components.bmi_frost_number import BmiFrostnumberMethod\r\nIn [2]: x = BmiFrostnumberMethod()\r\nIn [3]: x.initialize('frostnumber_model.cfg')\r\nIn [4]: x._model._configuration['start_year']\r\nOut[4]: 2000\r\nIn [5]: x._model._configuration['end_year']\r\nOut[5]: 2000\r\nIn [6]: x.get_value('frostnumber__air')\r\nOut[6]: array(0.3961466061143555)\r\nIn [7]: x.update()\r\n---------------------------------------------------------------------------\r\n<snip>\r\nValueError: Year is past last year\r\n```\r\n\r\nIt would be better if the value of `frostnumber__air` was set to some default value (e.g., -999.0) on initialization. The value of `frostnumber__air` for the one year run of the model would then be calculated during the update step. For example:\r\n\r\n```\r\nIn [10]: x.initialize('frostnumber_model.cfg')\r\nIn [11]: x.get_value('frostnumber__air')\r\nOut[11]: array(-999.0)\r\nIn [12]: x.update()\r\nIn [12]: x.get_value('frostnumber__air')\r\nOut[12]: array(0.3961466061143555)\r\n```\r\n\r\nThis is something that's not documented well by CSDMS, and something that I haven't explained well.\r\n\r\n```\r\n#===============================================================================\r\n# PermaModel Config File for: frostnumber_method\r\n#===============================================================================\r\n# Input\r\npermafrost_dir  | .          | string   | Set to root dir\r\ncomp_status     | Enabled             | string   | component status {Enabled; Disabled}\r\nin_directory    | .            | string   | input directory\r\nout_directory   | .           | string   | output directory\r\nsite_prefix     | Test             | string   | file prefix for the study site\r\ncase_prefix     | Case_test             | string   | file prefix for the model scenario\r\nT_air_min_type  | Scalar          | string               | allowed: {Scalar; Time_Series}\r\nT_air_min       | -9.0               | float   | Mean month air temperature coldest month [C]\r\nT_air_max_type  | Scalar          | string               | allowed: {Scalar; Time_Series}\r\nT_air_max       | 15.4               | float   | Mean month air temperature warmest month [C]\r\nstart_year      | 2000              | long     | begining of the simulation time [year]\r\nend_year        | 2000                | long     | end of the simulation time [year]\r\ndt              | 1.0                      | float    | Timestep for permafrost process [year]\r\n#===============================================================================\r\n# Output saved for user\r\n#===============================================================================\r\nfn_out_filename       | frostnumber_output.dat   | string       | Name of output file\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/permamodel/permamodel/issues/comments/301112779","html_url":"https://github.com/permamodel/permamodel/issues/44#issuecomment-301112779","issue_url":"https://api.github.com/repos/permamodel/permamodel/issues/44","id":301112779,"user":{"login":"sc0tts","id":16582646,"avatar_url":"https://avatars2.githubusercontent.com/u/16582646?v=3","gravatar_id":"","url":"https://api.github.com/users/sc0tts","html_url":"https://github.com/sc0tts","followers_url":"https://api.github.com/users/sc0tts/followers","following_url":"https://api.github.com/users/sc0tts/following{/other_user}","gists_url":"https://api.github.com/users/sc0tts/gists{/gist_id}","starred_url":"https://api.github.com/users/sc0tts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sc0tts/subscriptions","organizations_url":"https://api.github.com/users/sc0tts/orgs","repos_url":"https://api.github.com/users/sc0tts/repos","events_url":"https://api.github.com/users/sc0tts/events{/privacy}","received_events_url":"https://api.github.com/users/sc0tts/received_events","type":"User","site_admin":false},"created_at":"2017-05-12T15:45:11Z","updated_at":"2017-05-12T15:45:11Z","body":"How accurate is this pseudocode?\n\nI ask because looking at this, it seems like the last step in update()\nshould be to update the time, rather than the first.\n\nOn Thu, May 11, 2017 at 10:26 PM, Mark Piper <notifications@github.com>\nwrote:\n\n> The problem arises even with FNGeo. If the calculation of FN depends on\n> temperature which comes from cruAKtemp, how do I get the temperature for\n> the first (0th) timestep? If I initialize FNGeo first, then the framework\n> simply doesn't know the temperature yet. But if I initialize cruAKtemp\n> first, the it doesn't have anyplace (in the FNGeo model that hasn't loaded\n> yet) to set the temperature.\n>\n> CRUAKTemp is the provides port for FNGeo, so it's initialized and updated\n> first. PyMT handles it like this (some psuedocode):\n>\n> from pymt.components import FrostNumberGeoModel, CRUAKTemp\n>\n> f = FrostNumberGeoModel(), c = CRUAKTemp()\n> c.initialize('fileb.cfg')\n> f.initialize('filea.cfg')\n> while f.get_current_time() < f.get_end_time():\n>    temp = c.get_value('temperature__surface')\n>    f.set_value('temperature__surface', temp)\n>    c.update()\n>    f.update()\n> c.finalize(), f.finalize()\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/permamodel/permamodel/issues/44#issuecomment-300980630>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AP0H9og0o1CGODR_9PfPn0hru5osEzWPks5r4998gaJpZM4NYwiZ>\n> .\n>\n"}}
{"actor":{"display_login":"sc0tts"}}