Skip to content

Commit

Permalink
Merge branch 'release/1.14.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hector Castro committed Aug 10, 2016
2 parents b208983 + 89a57db commit df28c64
Show file tree
Hide file tree
Showing 18 changed files with 206 additions and 47 deletions.
14 changes: 13 additions & 1 deletion scripts/aws/setupdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ file_to_load=
load_stream=false
load_mapshed=false

while getopts ":hbsdmf:" opt; do
while getopts ":hbsdpmf:" opt; do
case $opt in
h)
echo -e $usage
Expand All @@ -33,6 +33,8 @@ while getopts ":hbsdmf:" opt; do
load_stream=true ;;
d)
load_drb_streams=true ;;
p)
load_dep=true ;;
m)
load_mapshed=true ;;
f)
Expand Down Expand Up @@ -74,6 +76,16 @@ if [ ! -z "$file_to_load" ] ; then
download_and_load $FILES
fi

if [ "$load_dep" = "true" ] ; then
# Fetch DEP layers
FILES=("dep_urban_areas.sql.gz" "dep_municipalities.sql.gz")
PATHS=("dep_urbanareas" "dep_municipalities")

download_and_load $FILES
purge_tile_cache $PATHS
fi


if [ "$load_boundary" = "true" ] ; then
# Fetch boundary layer sql files
FILES=("boundary_county.sql.gz" "boundary_school_district.sql.gz" "boundary_district.sql.gz" "boundary_huc12.sql.gz" "boundary_huc10.sql.gz" "boundary_huc08.sql.gz")
Expand Down
5 changes: 2 additions & 3 deletions src/mmw/apps/modeling/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@ def aoi_resolution(area_of_interest):


def format_quality(model_output):
measures = ['Biochemical Oxygen Demand',
'Total Suspended Solids',
measures = ['Total Suspended Solids',
'Total Nitrogen',
'Total Phosphorus']
codes = ['bod', 'tss', 'tn', 'tp']
codes = ['tss', 'tn', 'tp']

def fn(input):
measure, code = input
Expand Down
40 changes: 20 additions & 20 deletions src/mmw/apps/water_balance/templates/home_page/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,84 +210,84 @@ <h1 class="infil">0.0 cm</h1>

<li id="thumb-open_water">
<a href="#land-open_water" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-11">
<img src="{% static 'images/water_balance/thumb_openwater.png' %}" alt="Open Water" data-name="open_water" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-11">
<img src="{% static 'images/water_balance/thumb_openwater.png' %}" alt="Open Water" data-name="open_water" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-11">
</a>
<label>Water</label>
</li>

<li id="thumb-developed_open">
<a href="#land-developed_open" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-21">
<img src="{% static 'images/water_balance/thumb_turfGrass.png' %}" alt="Developed, Open Space" data-name="developed_open" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-21" >
<img src="{% static 'images/water_balance/thumb_turfGrass.png' %}" alt="Developed, Open Space" data-name="developed_open" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-21" >
</a>
<label>Developed-Open</label>
</li>

<li id="thumb-developed_low" class="active">
<a href="#land-developed_low" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-22">
<img src="{% static 'images/water_balance/thumb_lir.png' %}" alt="Developed, Low Intensity" data-name="developed_low" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-22" >
<img src="{% static 'images/water_balance/thumb_lir.png' %}" alt="Developed, Low Intensity" data-name="developed_low" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-22" >
</a>
<label>Developed-Low</label>
</li>

<li id="thumb-developed_med">
<a href="#land-developed_med" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-23">
<img src="{% static 'images/water_balance/thumb_hir.png' %}" alt="Developed, Medium Intensity" data-name="developed_med" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-23" >
<img src="{% static 'images/water_balance/thumb_hir.png' %}" alt="Developed, Medium Intensity" data-name="developed_med" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-23" >
</a>
<label>Developed-Med</label>
</li>

<li id="thumb-developed_high">
<a href="#land-developed_high" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-24">
<img src="{% static 'images/water_balance/thumb_commercial.png' %}" alt="Developed High Intensity" data-name="developed_high" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-24" >
<img src="{% static 'images/water_balance/thumb_commercial.png' %}" alt="Developed High Intensity" data-name="developed_high" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-24" >
</a>
<label>Developed-High</label>
</li>

<li id="thumb-barren_land">
<a href="#land-barren_land" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-31">
<img src="{% static 'images/water_balance/thumb_desert.png' %}" alt="Barren Land (Rock/Sand/Clay)" data-name="barren_land" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-31" >
<img src="{% static 'images/water_balance/thumb_desert.png' %}" alt="Barren Land (Rock/Sand/Clay)" data-name="barren_land" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-31" >
</a>
<label>Barren Land</label>
</li>

<li id="thumb-deciduous_forest">
<a href="#land-deciduous_forest" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-41">
<img src="{% static 'images/water_balance/thumb_forest.png' %}" alt="Forest" data-container="body" data-name="deciduous_forest" data-toggle="popover" data-placement="left" data-nlcd="nlcd-41" >
<img src="{% static 'images/water_balance/thumb_forest.png' %}" alt="Forest" data-container="body" data-name="deciduous_forest" data-toggle="popover" data-placement="left" data-category="nlcd-41" >
</a>
<label>Forest</label>
</li>

<li id="thumb-shrub">
<a href="#land-shrub" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-52">
<img src="{% static 'images/water_balance/thumb_chaparral.png' %}" alt="Shrub/Scrub" data-name="shrub" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-52" >
<img src="{% static 'images/water_balance/thumb_chaparral.png' %}" alt="Shrub/Scrub" data-name="shrub" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-52" >
</a>
<label>Shrub/Scrub</label>
</li>

<li id="thumb-grassland">
<a href="#land-grassland" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-71">
<img src="{% static 'images/water_balance/thumb_grassland.png' %}" alt="Grassland/Herbaceous" data-name="grassland" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-71" >
<img src="{% static 'images/water_balance/thumb_grassland.png' %}" alt="Grassland/Herbaceous" data-name="grassland" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-71" >
</a>
<label>Grassland</label>
</li>

<li id="thumb-pasture">
<a href="#land-pasture" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-81">
<img src="{% static 'images/water_balance/thumb_pasture.png' %}" alt="Pasture/Hay" data-name="pasture" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-81" >
<img src="{% static 'images/water_balance/thumb_pasture.png' %}" alt="Pasture/Hay" data-name="pasture" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-81" >
</a>
<label>Pasture/Hay</label>
</li>

<li id="thumb-cultivated_crops">
<a href="#land-cultivated_crops" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-82">
<img src="{% static 'images/water_balance/thumb_rowCrops.png' %}" alt="Cultivated Crops" data-name="cultivated_crops" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-82" >
<img src="{% static 'images/water_balance/thumb_rowCrops.png' %}" alt="Cultivated Crops" data-name="cultivated_crops" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-82" >
</a>
<label>Crops</label>
</li>

<li id="thumb-woody_wetlands">
<a href="#land-woody_wetlands" aria-controls="filter-tab" role="tab" data-toggle="tab" class="nlcd-90">
<img src="{% static 'images/water_balance/thumb_wetlands.png' %}" alt="Wetlands" data-name="woody_wetlands" data-container="body" data-toggle="popover" data-placement="left" data-nlcd="nlcd-90" >
<img src="{% static 'images/water_balance/thumb_wetlands.png' %}" alt="Wetlands" data-name="woody_wetlands" data-container="body" data-toggle="popover" data-placement="left" data-category="nlcd-90" >
</a>
<label>Wetlands</label>
</li>
Expand All @@ -302,29 +302,29 @@ <h1 class="infil">0.0 cm</h1>
<ul id="thumbs-soil" class="nav" role="tablist"> <!-- Soil Thumbs -->

<li id="thumb-sand" class="active"> <!-- Sand Thumb -->
<a href="#soil-sand" aria-controls="filter-tab" role="tab" data-toggle="tab">
<img src="{% static 'images/water_balance/thumb_sand.png' %}" alt="Sand" data-name="soil_a" data-container="body" data-toggle="popover" data-placement="left" >
<a href="#soil-sand" aria-controls="filter-tab" role="tab" data-toggle="tab" class="soil-a">
<img src="{% static 'images/water_balance/thumb_sand.png' %}" alt="Sand" data-name="soil_a" data-container="body" data-toggle="popover" data-placement="left" data-category="soil-a">
</a>
<label>A - High Infiltration</label>
</li>

<li id="thumb-loam"> <!-- Loam Thumb -->
<a href="#soil-loam" aria-controls="filter-tab" role="tab" data-toggle="tab">
<img src="{% static 'images/water_balance/thumb_loam.png' %}" alt="loam" data-name="soil_b" data-container="body" data-toggle="popover" data-placement="left" >
<a href="#soil-loam" aria-controls="filter-tab" role="tab" data-toggle="tab" class="soil-b">
<img src="{% static 'images/water_balance/thumb_loam.png' %}" alt="loam" data-name="soil_b" data-container="body" data-toggle="popover" data-placement="left" data-category="soil-b">
</a>
<label>B - Moderate Infiltration</label>
</li>

<li id="thumb-sandyClay"> <!-- Sandy Clay Thumb -->
<a href="#soil-sandyClay" aria-controls="filter-tab" role="tab" data-toggle="tab">
<img src="{% static 'images/water_balance/thumb_sandyClay.png' %}" alt="Sandy Clay" data-name="soil_c" data-container="body" data-toggle="popover" data-placement="left" >
<a href="#soil-sandyClay" aria-controls="filter-tab" role="tab" data-toggle="tab" class="soil-c">
<img src="{% static 'images/water_balance/thumb_sandyClay.png' %}" alt="Sandy Clay" data-name="soil_c" data-container="body" data-toggle="popover" data-placement="left" data-category="soil-c">
</a>
<label>C - Slow Infiltration</label>
</li>

<li id="thumb-clayLoam"> <!-- Clay Loam Thumb -->
<a href="#soil-clayLoam" aria-controls="filter-tab" role="tab" data-toggle="tab">
<img src="{% static 'images/water_balance/thumb_clayLoam.png' %}" alt="Clay Loam" data-name="soil_d" data-container="body" data-toggle="popover" data-placement="left" >
<a href="#soil-clayLoam" aria-controls="filter-tab" role="tab" data-toggle="tab" class="soil-d">
<img src="{% static 'images/water_balance/thumb_clayLoam.png' %}" alt="Clay Loam" data-name="soil_d" data-container="body" data-toggle="popover" data-placement="left" data-category="soil-d">
</a>
<label>D - Very Slow Infiltration</label>
</li>
Expand Down
1 change: 1 addition & 0 deletions src/mmw/js/src/compare/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ var CompareModelingView = Marionette.LayoutView.extend({
ResultView = modelingViews.getResultView(modelPackage, resultModel.get('name'));

this.resultRegion.show(new ResultView({
areaOfInterest: this.projectModel.get('area_of_interest'),
model: resultModel,
scenario: this.model,
compareMode: true
Expand Down
4 changes: 4 additions & 0 deletions src/mmw/js/src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ var utils = {
}
},

filterOutOxygenDemand: function(element) {
return element.measure !== "Biochemical Oxygen Demand";
},

// Reverse sorting of a Backbone Collection.
// Taken from http://stackoverflow.com/a/12220415/2053314
reverseSortBy: function(sortByFunction) {
Expand Down
17 changes: 16 additions & 1 deletion src/mmw/js/src/core/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ var MapView = Marionette.ItemView.extend({
} else if (!layer.empty) {
var tileUrl = (layer.url.match(/png/) === null ?
layer.url + '.png' : layer.url),
zIndex = layer.overlay ? 1 : 0;
zIndex = determineZIndex(layer);

_.defaults(layer, {
zIndex: zIndex,
Expand All @@ -425,6 +425,21 @@ var MapView = Marionette.ItemView.extend({
layers[layer['display']] = leafletLayer;
});

function determineZIndex(layer) {
// ZIndex rules to keep coverages under the boundary lines
// basemaps: 0
// overlay::raster: 1
// overlay::vector: 2

if (!layer.overlay) {
return 0;
} else if (layer.raster) {
return 1;
} else {
return 2;
}
}

function actOnUI(datum, bool) {
var code = datum.code,
$el = $('#overlays-layer-list #' + code);
Expand Down
4 changes: 2 additions & 2 deletions src/mmw/js/src/main_water_balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ var initBootstrap = function() {

$('[data-toggle="popover"]').each(function(i, popover) {
var $popover = $(popover),
nlcd = $popover.data('nlcd') || 'default',
category = $popover.data('category') || 'default',
template = '<div class="popover" role="tooltip">' +
'<div class="arrow"></div>' +
'<h3 class="popover-title ' + ' ' + nlcd + '"></h3>' +
'<h3 class="popover-title ' + ' ' + category + '"></h3>' +
'<div class="popover-content"></div></div>',
entry = modificationConfig[$popover.data('name')],
options = {
Expand Down
20 changes: 18 additions & 2 deletions src/mmw/js/src/modeling/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ var ModelingController = {

// Send URL to parent if in embed mode
updateItsiFromEmbedMode();

setPageTitle();
});
})
.fail(function() {
Expand All @@ -67,6 +69,8 @@ var ModelingController = {
console.log("[ERROR] Could not load project.");
App.currentProject = null;
});

App.state.set('current_page_title', 'Modeling');
} else {
if (App.currentProject && settings.get('activityMode')) {
project = App.currentProject;
Expand All @@ -85,6 +89,7 @@ var ModelingController = {
var lock = $.Deferred();

if (!App.currentProject) {

project = reinstateProject(App.projectNumber, lock);

App.currentProject = project;
Expand All @@ -99,9 +104,8 @@ var ModelingController = {

finishProjectSetup(project, lock);
}
setPageTitle();
}

App.state.set('current_page_title', 'Model');
},

makeNewProject: function(modelPackage) {
Expand All @@ -120,6 +124,7 @@ var ModelingController = {
updateUrl();
}
App.rootView.showCollapsable();
setPageTitle();
},

projectCleanUp: function() {
Expand Down Expand Up @@ -162,6 +167,8 @@ var ModelingController = {
if (project.get('is_activity')) {
settings.set('activityMode', true);
}

setPageTitle();
})
.fail(function() {
App.currentProject = null;
Expand Down Expand Up @@ -227,6 +234,14 @@ function finishProjectSetup(project, lock) {
});
}

function setPageTitle() {
var modelPackageName = App.currentProject.get('model_package'),
modelPackages = settings.get('model_packages'),
modelPackageDisplayName = _.find(modelPackages, {name: modelPackageName}).display_name;

App.state.set('current_page_title', modelPackageDisplayName);
}

function projectCleanUp() {
App.rootView.hideCollapsable();
if (App.currentProject) {
Expand Down Expand Up @@ -323,6 +338,7 @@ function reinstateProject(number, lock) {
'areaOfInterest': project.get('area_of_interest'),
'areaOfInterestName': project.get('area_of_interest_name')
});
setPageTitle();
lock.resolve();
});

Expand Down
6 changes: 6 additions & 0 deletions src/mmw/js/src/modeling/tr55/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ var AoiVolumeModel = Backbone.Model.extend({
adjust: function(depth) {
// Adjusted runoff is depth (cm) -> meters * the AoI area (m2)
return (depth / 100) * this.get('aoiArea');
},

getLoadingRate: function(load) {
// The loadingRate is the load per hectare.
// The aoiArea is in m^2, so we divide by 10000 to get hectares.
return load / (this.get('aoiArea') / 10000);
}
});

Expand Down
1 change: 1 addition & 0 deletions src/mmw/js/src/modeling/tr55/quality/templates/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<tr>
<th data-sortable="true">Quality Measure</th>
<th class="text-left" data-sortable="true" data-sorter="window.numericSort">Load (kg)</th>
<th class="text-left" data-sortable="true" data-sorter="window.numericSort">Loading Rate (kg/ha)</th>
<th class="text-left" data-sortable="true" data-sorter="window.numericSort">Average Concentration (mg/L)</th>
</tr>
</thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<td>{{ measure }}</td>
<td class="strong text-right">{{ load|round(3)|toLocaleString(3) }}</td>
<td class="strong text-right">{{ loadingRate|round(3)|toLocaleString(3) }}</td>
<td class="strong text-right">{{ concentration|round(1)|toLocaleString(1) }}</td>
Loading

0 comments on commit df28c64

Please sign in to comment.