OHI-Science / ohicore

Ocean Health Index - R library of core functions
http://ohi-science.org/ohicore
GNU General Public License v2.0
19 stars 19 forks source link

data: post Brazil layers & scores #35

Closed bbest closed 10 years ago

bbest commented 10 years ago

per Brazil layers request by Chris and Erich

bbest commented 10 years ago

From: Ben Best bbest@nceas.ucsb.edu Date: Thu, Mar 27, 2014 at 3:36 PM Subject: Re: OHI Brazil findings launch plans To: Cristiane Elfes cristiane.elfes@lifesci.ucsb.edu Cc: Erich J Pacheco epacheco@conservation.org, Guilherme Dutra gdutra@conservation.org, Ana Cintia Guazzelli aguazzelli@conservation.org, Debra Zeyen d.zeyen@conservation.org, Ben Halpern halpern@bren.ucsb.edu, Katie Longo longo@nceas.ucsb.edu, Darren Hardy drh@stanford.edu, Courtney Scarborough scarborough@nceas.ucsb.edu, Tiago Pinheiro tcisalpino@gmail.com

Hi All,

The data has been linked from OHI-Science.org under the Data heading: Brazil 2013 (data). Please let me know if you notice any problems. In future we will fold these case study datasets directly into the toolbox.

Cheers, BB

PS Changes made here: /usr/local/ohi/src/model/bin/run_brazil_model.sh (diff)

####
# add documentation

# getting error:
#  File "/usr/local/ohi/lib/python/ohi/__init__.py", line 50, in _loaddict
#     return dict([(row['code'].lower(), row['name'].replace(' ', '-')) for row in csv.DictReader(open('%s/%s.csv' % (os.getenv('OHI_PARAMDIR'), k)))])
# IOError: [Errno 2] No such file or directory: '/var/lib/ohi/param/dimensions.csv'
# /var/data/ohi/usr/local/src/param/dimensions.csv
ln -s /var/data/ohi/usr/local/src/param/* /var/lib/ohi/param/.
vi /var/data/ohi/usr/local/src/param/regions.csv
#id,code,name
#1,gl,global # <- removed this line while running below for just Brazil
#2,br,brazil

echo "Generating documentation..."
test -r latex.cache && rm latex.cache
cd $OHI_HOME/src/model
export study=brazil
export OHI_STUDY=$study

# add README.txt so python ohi.doc populates with files 
for d in `find ./brazil -type d -not -iwholename '*.svn*'`; do
    if [ ! -f "$d/README.txt" ]; then
        echo "$d/README.txt does NOT exist, touching for ohi.doc generation."
        touch $d/README.txt
    fi
done

python -m ohi.doc simple
python -m ohi.doc detailed
python -m ohi.doc lineage brazil
python bin/generate_lineage.py > ${study}/doc/sources.dot
bin/generate_sources_doc.sh
#python bin/dump_citations.py

echo "Auto-correcting terminology in documentation..."
for fn in ${study}*.markdown ${study}*.csv; do
    echo "  $fn"
    sed -i \
        -e 's/\bsustainability\b/resilience/g' \
        -e 's/\bvulnerability\b/pressures/g' \
        $fn
done

echo "Rendering documentation as HTML files..."
for fn in ${study}*.markdown; do
    html_fn="`basename $fn .markdown`.html"

    # see if our markdown output changed
    if [ -d .svn/text-base ]; then
        diff -q $fn .svn/text-base/${fn}.svn-base >/dev/null
        if [ $? -eq 0 -a -f $html_fn ]; then
            echo "  No changes to $fn"
            continue
        fi
    fi

    # otherwise generate an html file if it's stale
    if [ $fn -nt $html_fn -o ! -f $html_fn ]; then
        echo "  $fn"
        ohi-markdown2html $fn $html_fn
    fi
done

cd $OHI_HOME/src/model/brazil
# goals: psql -A -t -c 'select distinct g from global.results_goal'. also: /var/lib/ohi/param/goals.csv -> /var/data/ohi/usr/local/src/param/goals.csv
ln -s AO artisanal-fishing
ln -s BD biodiversity
ln -s CS carbon-storage
ln -s CW clean-waters
ln -s FP food-provision
ln -s LE livelihoods
ln -s NP natural-products
ln -s CP safe-coastlines
ln -s SP sense-of-place
ln -s TR tourism-and-recreation
# subgoals: psql -A -t -c 'select distinct g,c from global.results_component order by g,c' added: /var/lib/ohi/param/goals_subgoals.csv -> /var/data/ohi/usr/local/src/param/goals_subgoals.csv
ln -s HAB habitats
ln -s SPP species
ln -s FIS fishing
ln -s MAR mariculture
ln -s ECO economy
ln -s LIV livelihood
ln -s ICO iconic-species
ln -s LSP lasting-special-places

# make goals_subgoals.csv
dir_param=/var/data/ohi/usr/local/src/param
cp $dir_param/goals.csv $dir_param/goals_subgoals.csv
cat <<EOF >> /var/data/ohi/usr/local/src/param/goals_subgoals.csv
hab,habitats
spp,species
fis,fishing
mar,mariculture
eco,economy
liv,livelihood
ico,iconic-species
lsp,lasting-special-places
EOF
cat $dir_param/goals_subgoals.csv
ln -s $dir_param/goals_subgoals.csv /var/lib/ohi/param/.
cat ${OHI_PARAMDIR:-/var/lib/ohi/param}/goals_subgoals.csv | sed "1 d" | cut -d, -f2 # substitute line in bin/export_goal_data.sh

cd $OHI_HOME/src/model
bin/export_goal_data.sh

# NEXT: manually edit index.md from /Volumes/local_edit/src/model/brazil*.markdown
# and copy FROM index.md, doc, data, br_goaldata.zip -> data_goals TO /var/lib/ohi/www/data/br-2012

dir_ftp=/var/lib/ohi/www/data/br-2012
sudo chmod -R 775 $dir_ftp
sudo chgrp -R www-data $dir_ftp
sudo chown -R bbest $dir_ftp
ohi-markdown2html $dir_ftp/index.md $dir_ftp/index.html
z=$dir_ftp/`basename $dir_ftp`.zip
zip -r $z $dir_ftp -x $z
bbest commented 10 years ago

BR data: updated documentation with directory tree listing, removed SPP data

Changes made here: /usr/local/ohi/src/model/bin/run_brazil_model.sh (diff)

bbest commented 10 years ago

Edits:

BR-NCEAS-Species

At the time of this analysis, regional assessments for marine species had not yet undergone the final consistency checking process mandated by IUCN, thus final categories within Brazil are subject to change. For the most current and validated assessments, refer to:

http://www.icmbio.gov.br/portal/biodiversidade/fauna-brasileira/avaliacao-do-risco-de-extincao.html