{"action":"created","comment":{"url":"https://api.github.com/repos/UW-Hydro/VIC/pulls/comments/51606741","id":51606741,"diff_hunk":"@@ -59,96 +58,106 @@ parse_output_info(FILE                  *gp,\n \n     outfilenum = -1;\n     outvarnum = 0;\n-    while (!feof(gp)) {\n-        if (cmdstr[0] != '#' && cmdstr[0] != '\\n' && cmdstr[0] != '\\0') {\n-            sscanf(cmdstr, \"%s\", optstr);\n \n-            if (strcasecmp(\"N_OUTFILES\", optstr) == 0) {\n-                sscanf(cmdstr, \"%*s %d\", &tmp_noutfiles);\n-                free_out_data_files(out_data_files);\n-                options.Noutfiles = tmp_noutfiles;\n-                *out_data_files = calloc(options.Noutfiles,\n-                                         sizeof(*(*out_data_files)));\n-                outfilenum = -1;\n-                init_output_list(out_data, false, \"%.4f\", OUT_TYPE_FLOAT, 1);\n-                // PRT_SNOW_BAND is ignored if N_OUTFILES has been specified\n-                options.PRT_SNOW_BAND = false;\n-            }\n-            else if (strcasecmp(\"OUTFILE\", optstr) == 0) {\n-                outfilenum++;\n-                if (!options.Noutfiles) {\n-                    log_err(\"in global param file: \\\"N_OUTFILES\\\" must be \"\n-                            \"specified before you can specify \\\"OUTFILE\\\".\");\n-                }\n-                if (outfilenum >= (short int)options.Noutfiles) {\n-                    log_err(\"number of output files specified in N_OUTFILES \"\n-                            \"(%zu) is less than actual number of output files \"\n-                            \"defined in the global param file.\",\n-                            options.Noutfiles);\n-                }\n-                sscanf(cmdstr, \"%*s %s\", (*out_data_files)[outfilenum].prefix);\n+    // Count the number of output files listed in the global param file\n+    options.Noutfiles = count_n_outfiles(gp);\n \n-                // determine how many variable will be in this file before\n-                // allocating (GH: 209)\n-                (*out_data_files)[outfilenum].nvars = count_outfile_nvars(gp);\n+    // only parse the output info if there are output files to parse\n+    if (options.Noutfiles > 0) {\n+        free_out_data_files(out_data_files);\n \n-                (*out_data_files)[outfilenum].varid =\n-                    calloc((*out_data_files)[outfilenum].nvars,\n-                           sizeof(*((*out_data_files)[outfilenum].varid)));\n-                outvarnum = 0;\n-            }\n-            else if (strcasecmp(\"OUTVAR\", optstr) == 0) {\n-                if (outfilenum < 0) {\n-                    log_err(\"Error in global param file: \\\"OUTFILE\\\" must be \"\n-                            \"specified before you can specify \\\"OUTVAR\\\".\");\n-                }\n-                strcpy(format, \"\");\n-                strcpy(typestr, \"\");\n-                strcpy(multstr, \"\");\n-                sscanf(cmdstr, \"%*s %s %s %s %s\", varname, format, typestr,\n-                       multstr);\n-                if (strcasecmp(\"\", format) == 0) {\n-                    strcpy(format, \"*\");\n-                    type = OUT_TYPE_DEFAULT;\n-                    mult = 0; // 0 means default multiplier\n-                }\n-                else {\n-                    if (strcasecmp(\"OUT_TYPE_USINT\", typestr) == 0) {\n-                        type = OUT_TYPE_USINT;\n-                    }\n-                    else if (strcasecmp(\"OUT_TYPE_SINT\", typestr) == 0) {\n-                        type = OUT_TYPE_SINT;\n+        *out_data_files = calloc(options.Noutfiles,\n+                                 sizeof(*(*out_data_files)));\n+        init_output_list(out_data, false, \"%.4f\", OUT_TYPE_FLOAT, 1);","path":"vic/drivers/classic/src/parse_output_info.c","position":78,"original_position":78,"commit_id":"5af803c02bacf461ce429d99361f39de8ea88001","original_commit_id":"5af803c02bacf461ce429d99361f39de8ea88001","user":{"login":"jhamman","id":2443309,"avatar_url":"https://avatars.githubusercontent.com/u/2443309?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamman","html_url":"https://github.com/jhamman","followers_url":"https://api.github.com/users/jhamman/followers","following_url":"https://api.github.com/users/jhamman/following{/other_user}","gists_url":"https://api.github.com/users/jhamman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamman/subscriptions","organizations_url":"https://api.github.com/users/jhamman/orgs","repos_url":"https://api.github.com/users/jhamman/repos","events_url":"https://api.github.com/users/jhamman/events{/privacy}","received_events_url":"https://api.github.com/users/jhamman/received_events","type":"User","site_admin":false},"body":"This diff is doing something funny.  I actually didn't change this line.  In any event, I've updated the format string to `%.4g`.  This is just used to initialize the output list.  In most (maybe all) cases, this value is overwritten with a variable specific format string.","created_at":"2016-02-02T17:55:50Z","updated_at":"2016-02-02T17:55:50Z","html_url":"https://github.com/UW-Hydro/VIC/pull/374#discussion_r51606741","pull_request_url":"https://api.github.com/repos/UW-Hydro/VIC/pulls/374","_links":{"self":{"href":"https://api.github.com/repos/UW-Hydro/VIC/pulls/comments/51606741"},"html":{"href":"https://github.com/UW-Hydro/VIC/pull/374#discussion_r51606741"},"pull_request":{"href":"https://api.github.com/repos/UW-Hydro/VIC/pulls/374"}}},"pull_request":{"url":"https://api.github.com/repos/UW-Hydro/VIC/pulls/374","id":57181645,"html_url":"https://github.com/UW-Hydro/VIC/pull/374","diff_url":"https://github.com/UW-Hydro/VIC/pull/374.diff","patch_url":"https://github.com/UW-Hydro/VIC/pull/374.patch","issue_url":"https://api.github.com/repos/UW-Hydro/VIC/issues/374","number":374,"state":"open","locked":false,"title":"remove duplicate dimension info from global parameter file, fixes #366","user":{"login":"jhamman","id":2443309,"avatar_url":"https://avatars.githubusercontent.com/u/2443309?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamman","html_url":"https://github.com/jhamman","followers_url":"https://api.github.com/users/jhamman/followers","following_url":"https://api.github.com/users/jhamman/following{/other_user}","gists_url":"https://api.github.com/users/jhamman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamman/subscriptions","organizations_url":"https://api.github.com/users/jhamman/orgs","repos_url":"https://api.github.com/users/jhamman/repos","events_url":"https://api.github.com/users/jhamman/events{/privacy}","received_events_url":"https://api.github.com/users/jhamman/received_events","type":"User","site_admin":false},"body":"closes #366","created_at":"2016-01-26T08:30:24Z","updated_at":"2016-02-02T17:55:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74d0645cd2fa328418f2d36e6f47748d8ca8bf09","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/UW-Hydro/VIC/pulls/374/commits","review_comments_url":"https://api.github.com/repos/UW-Hydro/VIC/pulls/374/comments","review_comment_url":"https://api.github.com/repos/UW-Hydro/VIC/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UW-Hydro/VIC/issues/374/comments","statuses_url":"https://api.github.com/repos/UW-Hydro/VIC/statuses/5af803c02bacf461ce429d99361f39de8ea88001","head":{"label":"jhamman:fix/issue_366","ref":"fix/issue_366","sha":"5af803c02bacf461ce429d99361f39de8ea88001","user":{"login":"jhamman","id":2443309,"avatar_url":"https://avatars.githubusercontent.com/u/2443309?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamman","html_url":"https://github.com/jhamman","followers_url":"https://api.github.com/users/jhamman/followers","following_url":"https://api.github.com/users/jhamman/following{/other_user}","gists_url":"https://api.github.com/users/jhamman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamman/subscriptions","organizations_url":"https://api.github.com/users/jhamman/orgs","repos_url":"https://api.github.com/users/jhamman/repos","events_url":"https://api.github.com/users/jhamman/events{/privacy}","received_events_url":"https://api.github.com/users/jhamman/received_events","type":"User","site_admin":false},"repo":{"id":8168561,"name":"VIC","full_name":"jhamman/VIC","owner":{"login":"jhamman","id":2443309,"avatar_url":"https://avatars.githubusercontent.com/u/2443309?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamman","html_url":"https://github.com/jhamman","followers_url":"https://api.github.com/users/jhamman/followers","following_url":"https://api.github.com/users/jhamman/following{/other_user}","gists_url":"https://api.github.com/users/jhamman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamman/subscriptions","organizations_url":"https://api.github.com/users/jhamman/orgs","repos_url":"https://api.github.com/users/jhamman/repos","events_url":"https://api.github.com/users/jhamman/events{/privacy}","received_events_url":"https://api.github.com/users/jhamman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhamman/VIC","description":"The Variable Infiltration Capacity (VIC) Macroscale Hydrologic Model","fork":true,"url":"https://api.github.com/repos/jhamman/VIC","forks_url":"https://api.github.com/repos/jhamman/VIC/forks","keys_url":"https://api.github.com/repos/jhamman/VIC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhamman/VIC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhamman/VIC/teams","hooks_url":"https://api.github.com/repos/jhamman/VIC/hooks","issue_events_url":"https://api.github.com/repos/jhamman/VIC/issues/events{/number}","events_url":"https://api.github.com/repos/jhamman/VIC/events","assignees_url":"https://api.github.com/repos/jhamman/VIC/assignees{/user}","branches_url":"https://api.github.com/repos/jhamman/VIC/branches{/branch}","tags_url":"https://api.github.com/repos/jhamman/VIC/tags","blobs_url":"https://api.github.com/repos/jhamman/VIC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhamman/VIC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhamman/VIC/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhamman/VIC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhamman/VIC/statuses/{sha}","languages_url":"https://api.github.com/repos/jhamman/VIC/languages","stargazers_url":"https://api.github.com/repos/jhamman/VIC/stargazers","contributors_url":"https://api.github.com/repos/jhamman/VIC/contributors","subscribers_url":"https://api.github.com/repos/jhamman/VIC/subscribers","subscription_url":"https://api.github.com/repos/jhamman/VIC/subscription","commits_url":"https://api.github.com/repos/jhamman/VIC/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhamman/VIC/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhamman/VIC/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhamman/VIC/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhamman/VIC/contents/{+path}","compare_url":"https://api.github.com/repos/jhamman/VIC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhamman/VIC/merges","archive_url":"https://api.github.com/repos/jhamman/VIC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhamman/VIC/downloads","issues_url":"https://api.github.com/repos/jhamman/VIC/issues{/number}","pulls_url":"https://api.github.com/repos/jhamman/VIC/pulls{/number}","milestones_url":"https://api.github.com/repos/jhamman/VIC/milestones{/number}","notifications_url":"https://api.github.com/repos/jhamman/VIC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhamman/VIC/labels{/name}","releases_url":"https://api.github.com/repos/jhamman/VIC/releases{/id}","deployments_url":"https://api.github.com/repos/jhamman/VIC/deployments","created_at":"2013-02-12T22:13:59Z","updated_at":"2015-05-23T15:49:22Z","pushed_at":"2016-02-02T16:50:03Z","git_url":"git://github.com/jhamman/VIC.git","ssh_url":"git@github.com:jhamman/VIC.git","clone_url":"https://github.com/jhamman/VIC.git","svn_url":"https://github.com/jhamman/VIC","homepage":null,"size":13600,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"develop"}},"base":{"label":"UW-Hydro:develop","ref":"develop","sha":"9b5d9c925e53e566423a3b80a74471e15ab05b1a","user":{"login":"UW-Hydro","id":3475662,"avatar_url":"https://avatars.githubusercontent.com/u/3475662?v=3","gravatar_id":"","url":"https://api.github.com/users/UW-Hydro","html_url":"https://github.com/UW-Hydro","followers_url":"https://api.github.com/users/UW-Hydro/followers","following_url":"https://api.github.com/users/UW-Hydro/following{/other_user}","gists_url":"https://api.github.com/users/UW-Hydro/gists{/gist_id}","starred_url":"https://api.github.com/users/UW-Hydro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UW-Hydro/subscriptions","organizations_url":"https://api.github.com/users/UW-Hydro/orgs","repos_url":"https://api.github.com/users/UW-Hydro/repos","events_url":"https://api.github.com/users/UW-Hydro/events{/privacy}","received_events_url":"https://api.github.com/users/UW-Hydro/received_events","type":"Organization","site_admin":false},"repo":{"id":8064928,"name":"VIC","full_name":"UW-Hydro/VIC","owner":{"login":"UW-Hydro","id":3475662,"avatar_url":"https://avatars.githubusercontent.com/u/3475662?v=3","gravatar_id":"","url":"https://api.github.com/users/UW-Hydro","html_url":"https://github.com/UW-Hydro","followers_url":"https://api.github.com/users/UW-Hydro/followers","following_url":"https://api.github.com/users/UW-Hydro/following{/other_user}","gists_url":"https://api.github.com/users/UW-Hydro/gists{/gist_id}","starred_url":"https://api.github.com/users/UW-Hydro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UW-Hydro/subscriptions","organizations_url":"https://api.github.com/users/UW-Hydro/orgs","repos_url":"https://api.github.com/users/UW-Hydro/repos","events_url":"https://api.github.com/users/UW-Hydro/events{/privacy}","received_events_url":"https://api.github.com/users/UW-Hydro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UW-Hydro/VIC","description":"The Variable Infiltration Capacity (VIC) Macroscale Hydrologic Model","fork":false,"url":"https://api.github.com/repos/UW-Hydro/VIC","forks_url":"https://api.github.com/repos/UW-Hydro/VIC/forks","keys_url":"https://api.github.com/repos/UW-Hydro/VIC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UW-Hydro/VIC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UW-Hydro/VIC/teams","hooks_url":"https://api.github.com/repos/UW-Hydro/VIC/hooks","issue_events_url":"https://api.github.com/repos/UW-Hydro/VIC/issues/events{/number}","events_url":"https://api.github.com/repos/UW-Hydro/VIC/events","assignees_url":"https://api.github.com/repos/UW-Hydro/VIC/assignees{/user}","branches_url":"https://api.github.com/repos/UW-Hydro/VIC/branches{/branch}","tags_url":"https://api.github.com/repos/UW-Hydro/VIC/tags","blobs_url":"https://api.github.com/repos/UW-Hydro/VIC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UW-Hydro/VIC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UW-Hydro/VIC/git/refs{/sha}","trees_url":"https://api.github.com/repos/UW-Hydro/VIC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UW-Hydro/VIC/statuses/{sha}","languages_url":"https://api.github.com/repos/UW-Hydro/VIC/languages","stargazers_url":"https://api.github.com/repos/UW-Hydro/VIC/stargazers","contributors_url":"https://api.github.com/repos/UW-Hydro/VIC/contributors","subscribers_url":"https://api.github.com/repos/UW-Hydro/VIC/subscribers","subscription_url":"https://api.github.com/repos/UW-Hydro/VIC/subscription","commits_url":"https://api.github.com/repos/UW-Hydro/VIC/commits{/sha}","git_commits_url":"https://api.github.com/repos/UW-Hydro/VIC/git/commits{/sha}","comments_url":"https://api.github.com/repos/UW-Hydro/VIC/comments{/number}","issue_comment_url":"https://api.github.com/repos/UW-Hydro/VIC/issues/comments{/number}","contents_url":"https://api.github.com/repos/UW-Hydro/VIC/contents/{+path}","compare_url":"https://api.github.com/repos/UW-Hydro/VIC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UW-Hydro/VIC/merges","archive_url":"https://api.github.com/repos/UW-Hydro/VIC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UW-Hydro/VIC/downloads","issues_url":"https://api.github.com/repos/UW-Hydro/VIC/issues{/number}","pulls_url":"https://api.github.com/repos/UW-Hydro/VIC/pulls{/number}","milestones_url":"https://api.github.com/repos/UW-Hydro/VIC/milestones{/number}","notifications_url":"https://api.github.com/repos/UW-Hydro/VIC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UW-Hydro/VIC/labels{/name}","releases_url":"https://api.github.com/repos/UW-Hydro/VIC/releases{/id}","deployments_url":"https://api.github.com/repos/UW-Hydro/VIC/deployments","created_at":"2013-02-07T02:30:14Z","updated_at":"2016-01-12T18:16:59Z","pushed_at":"2016-02-02T16:50:01Z","git_url":"git://github.com/UW-Hydro/VIC.git","ssh_url":"git@github.com:UW-Hydro/VIC.git","clone_url":"https://github.com/UW-Hydro/VIC.git","svn_url":"https://github.com/UW-Hydro/VIC","homepage":"http://vic.readthedocs.org","size":20371,"stargazers_count":28,"watchers_count":28,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":106,"mirror_url":null,"open_issues_count":55,"forks":106,"open_issues":55,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UW-Hydro/VIC/pulls/374"},"html":{"href":"https://github.com/UW-Hydro/VIC/pull/374"},"issue":{"href":"https://api.github.com/repos/UW-Hydro/VIC/issues/374"},"comments":{"href":"https://api.github.com/repos/UW-Hydro/VIC/issues/374/comments"},"review_comments":{"href":"https://api.github.com/repos/UW-Hydro/VIC/pulls/374/comments"},"review_comment":{"href":"https://api.github.com/repos/UW-Hydro/VIC/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UW-Hydro/VIC/pulls/374/commits"},"statuses":{"href":"https://api.github.com/repos/UW-Hydro/VIC/statuses/5af803c02bacf461ce429d99361f39de8ea88001"}}}}