{"action":"created","comment":{"url":"https://api.github.com/repos/PecanProject/pecan/pulls/comments/78860442","id":78860442,"diff_hunk":"@@ -0,0 +1,114 @@\n+#!/usr/bin/Rscript\n+#PEcAn\n+#data\n+#xml\n+#pecan.zip, clim\n+\n+# input files is a xml file specifying what to get\n+#<input>\n+#  <type>Ameriflux</type>\n+#  <site>US-Dk3</site>\n+#  <lat>35.9782</lat>\n+#  <lon>-79.0942</lon>\n+#  <start_date>2001-01-01 00:00:00</start_date>\n+#  <end_date>2001-12-31 23:59:59</end_date>\n+#</input>\n+\n+#send all output to stdout (incl stderr)\n+sink(stdout(), type=\"message\")\n+\n+# get command line arguments\n+args <- commandArgs(trailingOnly = TRUE)\n+if (length(args) < 2) {\n+  allargs <- commandArgs(trailingOnly = FALSE)\n+  myCommand <- sub('--file=', '', allargs[grep('--file=', allargs)])\n+  print(paste0(\"Usage:    \", myCommand, \" xml_Input_File  cf-nc_Output_File [tempDirectory] [cacheDirectory]\"))\n+  print(paste0(\"Example1: \", myCommand, \" US-Dk3.xml US-Dk3.pecan.nc [/tmp/watever] [/tmp/cache]\"))\n+  print(paste0(\"Example2: \", myCommand, \" US-Dk3.xml US-Dk3.pecan.zip [/tmp/watever] [/tmp/cache]\"))\n+  q()\n+}\n+\n+# load required libraries\n+require(XML)\n+require(RPostgreSQL)\n+require(PEcAn.data.atmosphere)\n+require(PEcAn.DB)\n+\n+# 1st argument is the input xml file\n+input <- xmlToList(xmlParse(args[1]))\n+\n+# 2nd argument is the output file\n+outputfile <- args[2]\n+\n+# 3rd argument is the temp folder\n+ifelse(length(args) > 2, tempDir <- args[3], tempDir <- \".\")\n+\n+# 4th argument is the cachefolder\n+ifelse(length(args) > 3, cacheDir <- args[4], cacheDir <- tempDir)\n+cacheDir <- \"/home/polyglot/cache/PEcAn\"\n+\n+dbparams <- list(user = \"bety\", dbname = \"bety\", password=\"bety\", host=\"localhost\")\n+# variables definitioni\n+site_lat   <- ifelse(is.null(input$lat), NA, input$lat)\n+site_lon   <- ifelse(is.null(input$lon), NA, input$lon)\n+\n+#connect DB and get site name\n+con      <- db.open(dbparams)\n+#query site based on location\n+site <- db.query(paste0(\"SELECT id, sitename AS name FROM sites WHERE geometry = ST_GeogFromText('POINT(\", site_lon, \" \", site_lat, \")')\"),con)\n+if(length(site) < 0){\n+  #query site based on name\n+  site <- db.query(paste0(\"SELECT id, sitename AS name FROM sites WHERE sitename LIKE '%\", input$site, \"%'\"),con)\n+}\n+if(length(site) < 0){\n+  #insert site info\n+  return()","path":"contrib/browndog/PEcAn.R","position":65,"original_position":65,"commit_id":"139148b397a865354db14d4b6d8ec5236a27ea66","original_commit_id":"139148b397a865354db14d4b6d8ec5236a27ea66","user":{"login":"robkooper","id":1580696,"avatar_url":"https://avatars.githubusercontent.com/u/1580696?v=3","gravatar_id":"","url":"https://api.github.com/users/robkooper","html_url":"https://github.com/robkooper","followers_url":"https://api.github.com/users/robkooper/followers","following_url":"https://api.github.com/users/robkooper/following{/other_user}","gists_url":"https://api.github.com/users/robkooper/gists{/gist_id}","starred_url":"https://api.github.com/users/robkooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robkooper/subscriptions","organizations_url":"https://api.github.com/users/robkooper/orgs","repos_url":"https://api.github.com/users/robkooper/repos","events_url":"https://api.github.com/users/robkooper/events{/privacy}","received_events_url":"https://api.github.com/users/robkooper/received_events","type":"User","site_admin":false},"body":"Can you print out a message so we can see this in the log file. Probably best to use [quit(status=-1)](https://stat.ethz.ch/R-manual/R-devel/library/base/html/quit.html).","created_at":"2016-09-14T23:02:56Z","updated_at":"2016-09-14T23:02:56Z","html_url":"https://github.com/PecanProject/pecan/pull/1006#discussion_r78860442","pull_request_url":"https://api.github.com/repos/PecanProject/pecan/pulls/1006","_links":{"self":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/comments/78860442"},"html":{"href":"https://github.com/PecanProject/pecan/pull/1006#discussion_r78860442"},"pull_request":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/1006"}}},"pull_request":{"url":"https://api.github.com/repos/PecanProject/pecan/pulls/1006","id":84350573,"html_url":"https://github.com/PecanProject/pecan/pull/1006","diff_url":"https://github.com/PecanProject/pecan/pull/1006.diff","patch_url":"https://github.com/PecanProject/pecan/pull/1006.patch","issue_url":"https://api.github.com/repos/PecanProject/pecan/issues/1006","number":1006,"state":"open","locked":false,"title":"wrapper of met.process for browndog","user":{"login":"yan130","id":4979985,"avatar_url":"https://avatars.githubusercontent.com/u/4979985?v=3","gravatar_id":"","url":"https://api.github.com/users/yan130","html_url":"https://github.com/yan130","followers_url":"https://api.github.com/users/yan130/followers","following_url":"https://api.github.com/users/yan130/following{/other_user}","gists_url":"https://api.github.com/users/yan130/gists{/gist_id}","starred_url":"https://api.github.com/users/yan130/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yan130/subscriptions","organizations_url":"https://api.github.com/users/yan130/orgs","repos_url":"https://api.github.com/users/yan130/repos","events_url":"https://api.github.com/users/yan130/events{/privacy}","received_events_url":"https://api.github.com/users/yan130/received_events","type":"User","site_admin":false},"body":"please use example.xml on VM for test.\r\n","created_at":"2016-09-07T18:30:57Z","updated_at":"2016-09-14T23:04:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"642e39d5d6ee736a1319f9794c883cbc6425aa33","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/PecanProject/pecan/pulls/1006/commits","review_comments_url":"https://api.github.com/repos/PecanProject/pecan/pulls/1006/comments","review_comment_url":"https://api.github.com/repos/PecanProject/pecan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PecanProject/pecan/issues/1006/comments","statuses_url":"https://api.github.com/repos/PecanProject/pecan/statuses/139148b397a865354db14d4b6d8ec5236a27ea66","head":{"label":"yan130:wrapper-met.process","ref":"wrapper-met.process","sha":"139148b397a865354db14d4b6d8ec5236a27ea66","user":{"login":"yan130","id":4979985,"avatar_url":"https://avatars.githubusercontent.com/u/4979985?v=3","gravatar_id":"","url":"https://api.github.com/users/yan130","html_url":"https://github.com/yan130","followers_url":"https://api.github.com/users/yan130/followers","following_url":"https://api.github.com/users/yan130/following{/other_user}","gists_url":"https://api.github.com/users/yan130/gists{/gist_id}","starred_url":"https://api.github.com/users/yan130/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yan130/subscriptions","organizations_url":"https://api.github.com/users/yan130/orgs","repos_url":"https://api.github.com/users/yan130/repos","events_url":"https://api.github.com/users/yan130/events{/privacy}","received_events_url":"https://api.github.com/users/yan130/received_events","type":"User","site_admin":false},"repo":{"id":65502208,"name":"pecan","full_name":"yan130/pecan","owner":{"login":"yan130","id":4979985,"avatar_url":"https://avatars.githubusercontent.com/u/4979985?v=3","gravatar_id":"","url":"https://api.github.com/users/yan130","html_url":"https://github.com/yan130","followers_url":"https://api.github.com/users/yan130/followers","following_url":"https://api.github.com/users/yan130/following{/other_user}","gists_url":"https://api.github.com/users/yan130/gists{/gist_id}","starred_url":"https://api.github.com/users/yan130/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yan130/subscriptions","organizations_url":"https://api.github.com/users/yan130/orgs","repos_url":"https://api.github.com/users/yan130/repos","events_url":"https://api.github.com/users/yan130/events{/privacy}","received_events_url":"https://api.github.com/users/yan130/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yan130/pecan","description":"The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.","fork":true,"url":"https://api.github.com/repos/yan130/pecan","forks_url":"https://api.github.com/repos/yan130/pecan/forks","keys_url":"https://api.github.com/repos/yan130/pecan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yan130/pecan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yan130/pecan/teams","hooks_url":"https://api.github.com/repos/yan130/pecan/hooks","issue_events_url":"https://api.github.com/repos/yan130/pecan/issues/events{/number}","events_url":"https://api.github.com/repos/yan130/pecan/events","assignees_url":"https://api.github.com/repos/yan130/pecan/assignees{/user}","branches_url":"https://api.github.com/repos/yan130/pecan/branches{/branch}","tags_url":"https://api.github.com/repos/yan130/pecan/tags","blobs_url":"https://api.github.com/repos/yan130/pecan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yan130/pecan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yan130/pecan/git/refs{/sha}","trees_url":"https://api.github.com/repos/yan130/pecan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yan130/pecan/statuses/{sha}","languages_url":"https://api.github.com/repos/yan130/pecan/languages","stargazers_url":"https://api.github.com/repos/yan130/pecan/stargazers","contributors_url":"https://api.github.com/repos/yan130/pecan/contributors","subscribers_url":"https://api.github.com/repos/yan130/pecan/subscribers","subscription_url":"https://api.github.com/repos/yan130/pecan/subscription","commits_url":"https://api.github.com/repos/yan130/pecan/commits{/sha}","git_commits_url":"https://api.github.com/repos/yan130/pecan/git/commits{/sha}","comments_url":"https://api.github.com/repos/yan130/pecan/comments{/number}","issue_comment_url":"https://api.github.com/repos/yan130/pecan/issues/comments{/number}","contents_url":"https://api.github.com/repos/yan130/pecan/contents/{+path}","compare_url":"https://api.github.com/repos/yan130/pecan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yan130/pecan/merges","archive_url":"https://api.github.com/repos/yan130/pecan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yan130/pecan/downloads","issues_url":"https://api.github.com/repos/yan130/pecan/issues{/number}","pulls_url":"https://api.github.com/repos/yan130/pecan/pulls{/number}","milestones_url":"https://api.github.com/repos/yan130/pecan/milestones{/number}","notifications_url":"https://api.github.com/repos/yan130/pecan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yan130/pecan/labels{/name}","releases_url":"https://api.github.com/repos/yan130/pecan/releases{/id}","deployments_url":"https://api.github.com/repos/yan130/pecan/deployments","created_at":"2016-08-11T21:18:59Z","updated_at":"2016-08-11T21:19:05Z","pushed_at":"2016-09-12T17:12:12Z","git_url":"git://github.com/yan130/pecan.git","ssh_url":"git@github.com:yan130/pecan.git","clone_url":"https://github.com/yan130/pecan.git","svn_url":"https://github.com/yan130/pecan","homepage":"www.pecanproject.org","size":122128,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PecanProject:master","ref":"master","sha":"df5128712694e24d6879e317cb5262eb0b05073a","user":{"login":"PecanProject","id":2879854,"avatar_url":"https://avatars.githubusercontent.com/u/2879854?v=3","gravatar_id":"","url":"https://api.github.com/users/PecanProject","html_url":"https://github.com/PecanProject","followers_url":"https://api.github.com/users/PecanProject/followers","following_url":"https://api.github.com/users/PecanProject/following{/other_user}","gists_url":"https://api.github.com/users/PecanProject/gists{/gist_id}","starred_url":"https://api.github.com/users/PecanProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PecanProject/subscriptions","organizations_url":"https://api.github.com/users/PecanProject/orgs","repos_url":"https://api.github.com/users/PecanProject/repos","events_url":"https://api.github.com/users/PecanProject/events{/privacy}","received_events_url":"https://api.github.com/users/PecanProject/received_events","type":"Organization","site_admin":false},"repo":{"id":6857384,"name":"pecan","full_name":"PecanProject/pecan","owner":{"login":"PecanProject","id":2879854,"avatar_url":"https://avatars.githubusercontent.com/u/2879854?v=3","gravatar_id":"","url":"https://api.github.com/users/PecanProject","html_url":"https://github.com/PecanProject","followers_url":"https://api.github.com/users/PecanProject/followers","following_url":"https://api.github.com/users/PecanProject/following{/other_user}","gists_url":"https://api.github.com/users/PecanProject/gists{/gist_id}","starred_url":"https://api.github.com/users/PecanProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PecanProject/subscriptions","organizations_url":"https://api.github.com/users/PecanProject/orgs","repos_url":"https://api.github.com/users/PecanProject/repos","events_url":"https://api.github.com/users/PecanProject/events{/privacy}","received_events_url":"https://api.github.com/users/PecanProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PecanProject/pecan","description":"The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.","fork":false,"url":"https://api.github.com/repos/PecanProject/pecan","forks_url":"https://api.github.com/repos/PecanProject/pecan/forks","keys_url":"https://api.github.com/repos/PecanProject/pecan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PecanProject/pecan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PecanProject/pecan/teams","hooks_url":"https://api.github.com/repos/PecanProject/pecan/hooks","issue_events_url":"https://api.github.com/repos/PecanProject/pecan/issues/events{/number}","events_url":"https://api.github.com/repos/PecanProject/pecan/events","assignees_url":"https://api.github.com/repos/PecanProject/pecan/assignees{/user}","branches_url":"https://api.github.com/repos/PecanProject/pecan/branches{/branch}","tags_url":"https://api.github.com/repos/PecanProject/pecan/tags","blobs_url":"https://api.github.com/repos/PecanProject/pecan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PecanProject/pecan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PecanProject/pecan/git/refs{/sha}","trees_url":"https://api.github.com/repos/PecanProject/pecan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PecanProject/pecan/statuses/{sha}","languages_url":"https://api.github.com/repos/PecanProject/pecan/languages","stargazers_url":"https://api.github.com/repos/PecanProject/pecan/stargazers","contributors_url":"https://api.github.com/repos/PecanProject/pecan/contributors","subscribers_url":"https://api.github.com/repos/PecanProject/pecan/subscribers","subscription_url":"https://api.github.com/repos/PecanProject/pecan/subscription","commits_url":"https://api.github.com/repos/PecanProject/pecan/commits{/sha}","git_commits_url":"https://api.github.com/repos/PecanProject/pecan/git/commits{/sha}","comments_url":"https://api.github.com/repos/PecanProject/pecan/comments{/number}","issue_comment_url":"https://api.github.com/repos/PecanProject/pecan/issues/comments{/number}","contents_url":"https://api.github.com/repos/PecanProject/pecan/contents/{+path}","compare_url":"https://api.github.com/repos/PecanProject/pecan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PecanProject/pecan/merges","archive_url":"https://api.github.com/repos/PecanProject/pecan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PecanProject/pecan/downloads","issues_url":"https://api.github.com/repos/PecanProject/pecan/issues{/number}","pulls_url":"https://api.github.com/repos/PecanProject/pecan/pulls{/number}","milestones_url":"https://api.github.com/repos/PecanProject/pecan/milestones{/number}","notifications_url":"https://api.github.com/repos/PecanProject/pecan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PecanProject/pecan/labels{/name}","releases_url":"https://api.github.com/repos/PecanProject/pecan/releases{/id}","deployments_url":"https://api.github.com/repos/PecanProject/pecan/deployments","created_at":"2012-11-25T23:48:26Z","updated_at":"2016-08-23T17:13:27Z","pushed_at":"2016-09-14T22:17:10Z","git_url":"git://github.com/PecanProject/pecan.git","ssh_url":"git@github.com:PecanProject/pecan.git","clone_url":"https://github.com/PecanProject/pecan.git","svn_url":"https://github.com/PecanProject/pecan","homepage":"www.pecanproject.org","size":347879,"stargazers_count":47,"watchers_count":47,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":82,"mirror_url":null,"open_issues_count":205,"forks":82,"open_issues":205,"watchers":47,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/1006"},"html":{"href":"https://github.com/PecanProject/pecan/pull/1006"},"issue":{"href":"https://api.github.com/repos/PecanProject/pecan/issues/1006"},"comments":{"href":"https://api.github.com/repos/PecanProject/pecan/issues/1006/comments"},"review_comments":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/1006/comments"},"review_comment":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/1006/commits"},"statuses":{"href":"https://api.github.com/repos/PecanProject/pecan/statuses/139148b397a865354db14d4b6d8ec5236a27ea66"}}}}
{"actor":{"display_login":"robkooper"}}