Skip to content

Commit

Permalink
Merge pull request #151 from UMN-LATIS/ellipse-stats-bugfixes
Browse files Browse the repository at this point in the history
Ellipse Statistics Bugfixes
  • Loading branch information
thorn573 authored Mar 6, 2024
2 parents fee4a3e + ceff544 commit 8a8e318
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
I"�{"source"=>"C:/Users/thorn/Documents/GitHub/leaflet-treering", "destination"=>"C:/Users/thorn/Documents/GitHub/leaflet-treering/_site", "collections_dir"=>"", "cache_dir"=>".jekyll-cache", "plugins_dir"=>"_plugins", "layouts_dir"=>"_layouts", "data_dir"=>"_data", "includes_dir"=>"_includes", "collections"=>{"posts"=>{"output"=>true, "permalink"=>"/:categories/:year/:month/:day/:title:output_ext"}}, "safe"=>false, "include"=>["testassets"], "exclude"=>[".sass-cache", ".jekyll-cache", "gemfiles", "Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"], "keep_files"=>[".git", ".svn"], "encoding"=>"utf-8", "markdown_ext"=>"markdown,mkdown,mkdn,mkd,md", "strict_front_matter"=>false, "show_drafts"=>nil, "limit_posts"=>0, "future"=>false, "unpublished"=>false, "whitelist"=>[], "plugins"=>[], "markdown"=>"kramdown", "highlighter"=>"rouge", "lsi"=>false, "excerpt_separator"=>"\n\n", "incremental"=>false, "detach"=>false, "port"=>"4000", "host"=>"127.0.0.1", "baseurl"=>nil, "show_dir_listing"=>false, "permalink"=>"date", "paginate_path"=>"/page:num", "timezone"=>nil, "quiet"=>false, "verbose"=>false, "defaults"=>[], "liquid"=>{"error_mode"=>"warn", "strict_filters"=>false, "strict_variables"=>false}, "kramdown"=>{"auto_ids"=>true, "toc_levels"=>[1, 2, 3, 4, 5, 6], "entity_output"=>"as_char", "smart_quotes"=>"lsquo,rsquo,ldquo,rdquo", "input"=>"GFM", "hard_wrap"=>false, "guess_lang"=>true, "footnote_nr"=>1, "show_warnings"=>false, "syntax_highlighter"=>"rouge", "syntax_highlighter_opts"=>{:default_lang=>"plaintext", :guess_lang=>true}, "coderay"=>{}}, "sass"=>{"load_paths"=>["_sass"]}, "livereload_port"=>35729, "serving"=>true, "watch"=>true, "url"=>"http://localhost:4000"}:ET
I"i{"source"=>"C:/Users/dozac/OneDrive/Documents/GitHub/leaflet-treering", "destination"=>"C:/Users/dozac/OneDrive/Documents/GitHub/leaflet-treering/_site", "collections_dir"=>"", "cache_dir"=>".jekyll-cache", "plugins_dir"=>"_plugins", "layouts_dir"=>"_layouts", "data_dir"=>"_data", "includes_dir"=>"_includes", "collections"=>{"posts"=>{"output"=>true, "permalink"=>"/:categories/:year/:month/:day/:title:output_ext"}}, "safe"=>false, "include"=>["testassets"], "exclude"=>[".sass-cache", ".jekyll-cache", "gemfiles", "Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"], "keep_files"=>[".git", ".svn"], "encoding"=>"utf-8", "markdown_ext"=>"markdown,mkdown,mkdn,mkd,md", "strict_front_matter"=>false, "show_drafts"=>nil, "limit_posts"=>0, "future"=>false, "unpublished"=>false, "whitelist"=>[], "plugins"=>[], "markdown"=>"kramdown", "highlighter"=>"rouge", "lsi"=>false, "excerpt_separator"=>"\n\n", "incremental"=>false, "detach"=>false, "port"=>"4000", "host"=>"127.0.0.1", "baseurl"=>nil, "show_dir_listing"=>false, "permalink"=>"date", "paginate_path"=>"/page:num", "timezone"=>nil, "quiet"=>false, "verbose"=>false, "defaults"=>[], "liquid"=>{"error_mode"=>"warn", "strict_filters"=>false, "strict_variables"=>false}, "kramdown"=>{"auto_ids"=>true, "toc_levels"=>[1, 2, 3, 4, 5, 6], "entity_output"=>"as_char", "smart_quotes"=>"lsquo,rsquo,ldquo,rdquo", "input"=>"GFM", "hard_wrap"=>false, "guess_lang"=>true, "footnote_nr"=>1, "show_warnings"=>false}, "sass"=>{"load_paths"=>["_sass"]}, "livereload_port"=>35729, "serving"=>true, "watch"=>true, "url"=>"http://localhost:4000"}:ET
16 changes: 8 additions & 8 deletions Leaflet.AreaCapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,15 @@ function EllipseCSVDownload(Inte) {
EllipseCSVDownload.prototype.raw = function(wantNA) {
let assetName = Inte.treering.meta.assetName;
let csvString = `${assetName}_year,${assetName}_area_mm2`;
let startYear = Inte.ellipseData.data[0].year;
let endYear = Inte.ellipseData.data[Inte.ellipseData.data.length - 1].year;

let startYear = Math.floor(Inte.ellipseData.data[0].year);
let endYear = Math.floor(Inte.ellipseData.data[Inte.ellipseData.data.length - 1].year);
let n = 0;

for (let year = startYear; year <= endYear; year++) {
let yearHasData = false
for (i = n; i < Inte.ellipseData.data.length && year == Inte.ellipseData.data[i].year; i++) {
csvString += "\n" + year + "," + Inte.ellipseData.data[i].area.toFixed(3);
for (i = n; i < Inte.ellipseData.data.length && year == Math.floor(Inte.ellipseData.data[i].year); i++) {
csvString += "\n" + Inte.ellipseData.data[i].year + "," + Inte.ellipseData.data[i].area.toFixed(3);
yearHasData = true;
n++;
}
Expand All @@ -284,7 +285,6 @@ function EllipseCSVDownload(Inte) {
csvString += "\n" + year + ",NA";
}
}

return csvString
}

Expand All @@ -296,13 +296,13 @@ function EllipseCSVDownload(Inte) {
EllipseCSVDownload.prototype.stats = function(wantNA) {
//Constructs an object with an array of data for each year
let yearDataPairings = {};
let startYear = Inte.ellipseData.data[0].year;
let endYear = Inte.ellipseData.data[Inte.ellipseData.data.length - 1].year;
let startYear = Math.floor(Inte.ellipseData.data[0].year);
let endYear = Math.floor(Inte.ellipseData.data[Inte.ellipseData.data.length - 1].year);
let n = 0;

for (let year = startYear; year <= endYear; year++) {
yearDataPairings[year] = [];
for (let i = n; i < Inte.ellipseData.data.length && year == Inte.ellipseData.data[i].year; i++) {
for (let i = n; i < Inte.ellipseData.data.length && year == Math.floor(Inte.ellipseData.data[i].year); i++) {
yearDataPairings[year].push(Inte.ellipseData.data[i].area);
n++;
}
Expand Down

0 comments on commit 8a8e318

Please sign in to comment.