diff --git a/Gemfile.lock b/Gemfile.lock index d500c3d..771e3e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -285,7 +285,7 @@ GEM rspec-mocks (~> 3.12) rspec-support (~> 3.12) rspec-support (3.12.1) - rubocop (1.56.1) + rubocop (1.56.2) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -356,7 +356,7 @@ GEM uglifier (4.2.0) execjs (>= 0.3.0, < 3) unicode-display_width (2.4.2) - webmock (3.18.1) + webmock (3.19.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) diff --git a/app/assets/stylesheets/style.css.scss b/app/assets/stylesheets/style.css.scss index 5f12718..5957910 100644 --- a/app/assets/stylesheets/style.css.scss +++ b/app/assets/stylesheets/style.css.scss @@ -606,7 +606,7 @@ div .success { .map-container { margin-bottom: 1em; - padding: 0 20px; + // padding: 0 20px; @media #{$small-only} { padding: 0; @@ -614,19 +614,20 @@ div .success { } .map-form { - padding: 10px; + padding: 10px 10px 5px 10px; border: 1px solid $form-border-color; border-radius: 5px; background: $map-form-bg-color; - flex: 1 1 auto; -} - -.form-row { - margin-bottom: 1em; + margin-bottom: 10px; } -.form-row:last-child { - margin-bottom: 0; +.map-form-row { + line-height: 20px; + margin-bottom: 5px; + display: flex; + flex-wrap: wrap; + flex-direction: row; + gap: 5px 15px; } .grey { diff --git a/app/controllers/subscribers_controller.rb b/app/controllers/subscribers_controller.rb index 29a0673..00672cd 100644 --- a/app/controllers/subscribers_controller.rb +++ b/app/controllers/subscribers_controller.rb @@ -21,7 +21,7 @@ class SubscribersController < ApplicationController def index # only show the index page when logged out - return redirect_to(action: :manage) unless @subscriber.nil? + redirect_to(action: :manage) unless @subscriber.nil? end def new @@ -151,7 +151,7 @@ def create # confirm email def confirm @subscriber = Subscriber.find(params[:id]) - return redirect_to action: :manage if @subscriber.is_confirmed? + redirect_to action: :manage if @subscriber.is_confirmed? end # handle link from confirmation email @@ -353,7 +353,7 @@ def disable_subscription private def require_session - return reject("You must be logged in to perform this action.") if session[:subscriber].nil? + reject("You must be logged in to perform this action.") if session[:subscriber].nil? end def fix_email diff --git a/app/controllers/weather_controller.rb b/app/controllers/weather_controller.rb index 2cbe64d..6f3b02a 100644 --- a/app/controllers/weather_controller.rb +++ b/app/controllers/weather_controller.rb @@ -11,12 +11,15 @@ def et parse_cumulative_params @units = params[:units].presence || "in" @unit_opts = ["in", "mm"] + @cum_stat_opts = ["sum", "avg", "min", "max"] + @stat = params[:stat].presence || @cum_stat_opts[0] @et_methods = ["classic", "adjusted"] @et_method = params[:et_method].presence || "classic" @wi_only = params[:wi_only] == "true" @map_opts = { date: @date, start_date: @start_date, + stat: @start_date ? @stat : nil, units: @units, extent: @wi_only ? "wi" : nil }.compact @@ -53,10 +56,13 @@ def insol parse_cumulative_params @units = params[:units].presence || "MJ" @unit_opts = ["MJ", "KWh"] + @cum_stat_opts = ["sum", "avg", "min", "max"] + @stat = params[:stat].presence || @cum_stat_opts[0] @wi_only = params[:wi_only] == "true" @map_opts = { date: @date, start_date: @start_date, + stat: @start_date ? @stat : nil, units: @units, extent: @wi_only ? "wi" : nil }.compact @@ -82,7 +88,8 @@ def weather @unit_opts = ["F", "C"] @units = params[:units].presence || @unit_opts[0] @stat_opts = ["avg", "min", "max"] - @stat = params[:stat].presence || @stat_opts[0] + @cum_stat_opts = @stat_opts + @stat = params[:stat].presence || (@start_date ? @cum_stat_opts[0] : @stat_opts[0]) @temp_selector = true @wi_only = params[:wi_only] == "true" @map_opts = { @@ -113,10 +120,13 @@ def precip parse_cumulative_params @units = params[:units].presence || "in" @unit_opts = ["mm", "in"] + @cum_stat_opts = ["sum", "avg", "max"] + @stat = params[:stat].presence || @cum_stat_opts[0] @wi_only = params[:wi_only] == "true" @map_opts = { date: @date, start_date: @start_date, + stat: @start_date ? @stat : nil, units: @units, extent: @wi_only ? "wi" : nil }.compact diff --git a/app/models/t403.rb b/app/models/t403.rb index 6119c63..2edb6a0 100644 --- a/app/models/t403.rb +++ b/app/models/t403.rb @@ -6,7 +6,7 @@ class T403 < ApplicationRecord def self.description "Pre-2000 Half-Hourly Weather and Soil" end - + def self.attr_human_readables [ ["date", "Date"], diff --git a/app/views/weather/_map_form__browse.html.erb b/app/views/weather/_map_form__browse.html.erb index bebda46..99ecb7c 100644 --- a/app/views/weather/_map_form__browse.html.erb +++ b/app/views/weather/_map_form__browse.html.erb @@ -1,50 +1,49 @@ -
+
For more details on the science behind these products, see Diak et al, "Agricultural Management Decision Aids Driven by Real-Time Satellite Data", Bulletin of the American Meteorological Society 79 (1998): 1345-1355. <%= link_to "Link to article", "https://doi.org/10.1175/1520-0477(1998)079%3C1345:AMDADB%3E2.0.CO;2" %>. <%= link_to "Download PDF", "/Diak-et-al-1998.pdf", target: "_blank" %>.
Daily evapotranspiration maps in the default units are already rendered by our server and can be browsed quickly. Changing the units or using the cumulative map tool below will take around 10 seconds to render the image
-<% if @start_date %> -Please wait, loading map may take up to 10 seconds...
@@ -41,18 +36,15 @@ <% end %> <% end %> -The gridded insolation estimates shown below are imported daily from <%= link_to "UW Madison's Space Science Engineering Center", "https://ssec.wisc.edu" %> and provided on this page for easy access. Data is aggregated to a 0.1 decimal degree scale (roughly 8km E/W by 11km N/S in Wisconsin). We use this data, in combination with <%= link_to "gridded daily temperature datasets", action: :weather %>, to generate our <%= link_to "evapotranspiration estimates", action: :et %>.
Daily insolation maps in the default units are already rendered by our server and can be browsed quickly. Changing the units or using the cumulative map tool below will take around 10 seconds to render the image
-<% if @start_date %> -Please wait, loading map may take up to 10 seconds...
@@ -41,15 +36,12 @@ <% end %> <% end %> -<%= link_to "Download the entire grid of data for #{@date.strftime("%b %-d")} in CSV format", action: :insol, format: :csv, params: { date: @date } %>.
-Choose a location and date range then click "Get Data Series". Daily insolation data will be displayed in units of Mj and kWh. Note: You can click on the map to set the latitude and longitude to within half a degree.
<%= render partial: "partials/grid_selector", locals: { target: url_for(action: :insol_data) } %> diff --git a/app/views/weather/precip.html.erb b/app/views/weather/precip.html.erb index e59a4cf..7a6c637 100644 --- a/app/views/weather/precip.html.erb +++ b/app/views/weather/precip.html.erb @@ -17,18 +17,13 @@Use this page to access gridded precipitation data for the upper Midwest. This data is collected daily from NOAA datasets, which are generated from a combination of real-world observations and computer modeling. Data is aggregated to a 0.1 decimal degree scale (roughly 8km E/W by 11km N/S in Wisconsin). Precpitation can be highly localized, so these data may not completely match observations from rain gauges or weather stations, but should be relatively close. Consider checking <%= link_to "weather.gov", "https://www.weather.gov", target: "_blank" %> or <%= link_to "wunderground.com", "https://www.wunderground.com", target: "_blank" %> for weather/precipitation history or forecasts from an individual weather station.
Daily maps in the default units are already rendered by our server and can be browsed quickly. Changing units or using the cumulative map tool below will take around 10 seconds to render the image.
-<% if @start_date %> -Please wait, loading map may take up to 10 seconds...
@@ -40,15 +35,12 @@ <% end %> <% end %> -<%= link_to "Download the entire grid of data for #{@date.strftime("%b %-d")} in CSV format", action: :precip, format: :csv, params: { date: @date } %>.
-Choose a location and date range then click "Get Data Series". Daily and cumulative precipitation will be displayed in mm and inches. Note: you can click on the map or click the "Get my location" button to set the lat/long.
<%= render partial: "partials/grid_selector", locals: { target: url_for(action: :precip_data) } %> diff --git a/app/views/weather/weather.html.erb b/app/views/weather/weather.html.erb index badc70f..78d0f17 100644 --- a/app/views/weather/weather.html.erb +++ b/app/views/weather/weather.html.erb @@ -17,8 +17,8 @@This gridded weather data is imported daily from the <%= link_to "National Oceanic and Atmospheric Administration", "https://www.nco.ncep.noaa.gov/pmb/products/rtma/" %> and includes air temperatures and dew points. From these data we compute vapor pressure and relative humidity. The map below shows mean daily air temperature, but all weather parameters may be viewed by clicking on the map or selecting a specific Latitude/Longitude and clicking 'Get Data Series' in the box below. Use the buttons above the map to view a different date.
Daily maps in the default units are already rendered by our server and can be browsed quickly. Changing units or using the cumulative map tool below will take around 10 seconds to render the image.
-