Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions ccsr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# CCSR Maprooms

# Installation and Run Instructions

## Creating a conda environment with this project's dependencies

* see enacts' README

## Running the application in a development environment

* Activate the environment

`conda activate enactsmaproom`

* Create a development configuration file by copying `config-dev-sample.yaml` to `config-dev.yaml` and editing it as needed. Be careful not to commit config-dev.yaml that might hold secrets.

* Start the development server using your development config file with the iri or test-pycpt conf, e.g.:

`CONFIG=config-iri.yaml:config-dev.yaml python app.py`

* Navigate your browser to the URL that is displayed when the server starts, e.g. `http://127.0.0.1:8050/python_maproom/`

* When done using the server stop it with CTRL-C.

# Development Overview

see enacts' README

## Adding or removing dependencies

see enacts' README

## Building the documentation

see enacts' README

# Docker Build Instructions

TBD

# Support

* `help@iri.columbia.edu`
37 changes: 37 additions & 0 deletions ccsr/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import flask
import importlib
import os

from globals_ import FLASK, GLOBAL_CONFIG
import homepage
import pingrid

for name, config in GLOBAL_CONFIG['maprooms'].items():
if config is not None:
module = importlib.import_module(name)
if isinstance(config, list):
for c in config:
module.register(FLASK, c)


@FLASK.route(f"{GLOBAL_CONFIG['url_path_prefix']}/health")
def health_endpoint():
return flask.jsonify({'status': 'healthy', 'name': 'python_maproom'})


if __name__ == "__main__":
if GLOBAL_CONFIG["mode"] != "prod":
import warnings
warnings.simplefilter("error")
debug = True
else:
debug = False

FLASK.run(
GLOBAL_CONFIG["dev_server_interface"],
GLOBAL_CONFIG["dev_server_port"],
debug=debug,
extra_files=os.environ["CONFIG"].split(":"),
processes=GLOBAL_CONFIG["dev_processes"],
threaded=False,
)
24 changes: 24 additions & 0 deletions ccsr/config-defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
zoom: 2
url_path_prefix: /python_maproom

# DB configuration for the production docker environment. Override in
# development environment.
db:
host: postgres
port: 5432
user: ingrid
dbname: iridb

maprooms:

flex_fcst:

# App set up
- title: flex_cst_precip
core_path: flex_fcst_precip
forecast_path: /Data/data21/iri/FD.3
variable: Precipitation
y_transform: False
method: elr # or pycpt
var: precip
issue_format: "%b %Y"
9 changes: 9 additions & 0 deletions ccsr/config-dev-sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Configuration overrides for development. Copy this file to config-dev.yaml and edit as needed.

mode: debug # debug, devel or prod
dev_server_interface: 127.0.0.1
dev_server_port: 8050
dev_processes: 4
db:
host: localhost # at IRI, set this to dlcomputemon1.iri.columbia.edu
password: null # at IRI, get the password from another developer
37 changes: 37 additions & 0 deletions ccsr/config-iri.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
zoom: 2

datasets:

shapes_adm:
- name: Countries
color: black
sql: select adm0_code as key, adm0_name as label,
ST_AsBinary(ST_SimplifyPreserveTopology(coarse_geom, 0.01)) as the_geom
from g2015_2012_0
is_checked: True
- name: 1st_order
color: grey
sql: select (adm0_code, adm1_code) as key, adm1_name as label,
ST_AsBinary(ST_SimplifyPreserveTopology(coarse_geom, 0.01)) as the_geom
from g2015_2014_1
is_checked: False
- name: 2nd_order
color: grey
sql: select (adm0_code, adm1_code) as key, adm1_name as label,
ST_AsBinary(ST_SimplifyPreserveTopology(coarse_geom, 0.01)) as the_geom
from g2015_2014_2
is_checked: False

maprooms:

flex_fcst:

# App set up
- title: flex_cst_precip
core_path: flex_fcst_precip
forecast_path: /Data/data21/iri/FD.3
variable: Precipitation
y_transform: False
method: elr # or pycpt
var: precip
issue_format: "%b %Y"
28 changes: 28 additions & 0 deletions ccsr/config-test-pycpt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
zoom: 7

datasets:
shapes_adm:
- name: Pays
color: black
sql: select id_0 as key, name_0 as label, ST_AsBinary(the_geom) as the_geom
from sen_adm0
is_checked: False
- name: Regions
color: black
sql: select id_1 as key, name_1 as label, ST_AsBinary(the_geom) as the_geom
from sen_adm1
is_checked: True

maprooms:

flex_fcst:
- y_transform: false
variable: Precipitation
#Use one or the other to test the nc multiple/single cases
forecast_path: /data/remic/mydatafiles/ANACIM/cpt_demo/UCSBV3
#forecast_path: /data/remic/mydatafiles/ANACIM/cpt_demo/UCSBV3/Jul-Sep
title: flex_cst_precip
core_path: flex_fcst_precip
method: pycpt # or pycpt or elr
var: precip
issue_format: "%b-%Y"
Loading
Loading