Skip to content

Commit

Permalink
minor comment update and password hidding
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafnuss committed Jan 1, 2022
1 parent 84f8c21 commit ce4d4ff
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ docs/_build/
target/
.DS_Store
assets/taxonomy*
auth.json
32 changes: 12 additions & 20 deletions script_e2L.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
#!/usr/bin/env python
import os
import sys
import urllib.parse
import subprocess

# debug
#import importlib
#spec = importlib.util.spec_from_file_location("module.name", "./e2L.py")
#e2L = importlib.util.module_from_spec(spec)
#spec.loader.exec_module(e2L)

import e2L
import importlib
importlib.reload(e2L)
import json
#import importlib
#importlib.reload(e2L) # to reload the module if modified

# create project metadata
projet_name = "Puerto Rico"
filename = projet_name.replace(' ','_').replace("'",'').replace('.','')

# 1. Authentify
# Sesssion is required to download barchart data
session = e2L.auth('rafnuss','12468935')
with open('auth.json') as f:
auth = json.load(f)
session = e2L.auth(auth['username'], auth['password'])

#1. Create the Bird List loading data from eBird
# 2. Create the Bird List loading data from eBird
code_loc = 'PR' # See possible country code here : https://confluence.cornell.edu/display/CLOISAPI/eBird-1.1-HotSpotsByRegion + region code for each region ? where ?
lang = ['EN'] # a single language, or list of several language en,en_US,de,en_AE,en_AU,en_IN,en_NZ,en_UK,en_ZA,es,es_AR,es_CL,es_CU, es_DO,es_ES,es_MX,es_PA,es_PR,fi,fr,fr_HT,ht_HT,in,is,pt_BR,pt_PT,tr,zh https://support.ebird.org/en/support/solutions/articles/48000804865-bird-names-in-ebird
cat = ['species'] # domestic,form,hybrid,intergrade,issf,slash,species,spuh
Expand All @@ -32,7 +25,7 @@
emonth = 12
info, bird_list = e2L.bird_creator(session, code_loc, lang, cat, byear, eyear, bmonth, emonth)

#3. Add Status
# 3. Add Status
# status can be any of the following: target (year/life - per region/world), endemic, introduced
target_loc = "world" # or any codeLoc
target_time = "life" # "year" "life"
Expand All @@ -44,7 +37,7 @@
# 4. Add endemic & Introduced
bird_list = e2L.statusAvibase(['endemic-PR','introduce-PR'],bird_list, code_loc)

#2. Define column et Condition
# 5. Define column et Condition
# col.append(TableInput(type,option1,option1,option2,option3))
# type option1 option 2
# checkbox number of checkbox
Expand Down Expand Up @@ -72,15 +65,14 @@
condition_rare = ['\\footnotesize{>.1\\%}'," (bird['freq']['year'] < .00) and (bird['freq']['year'] > 0.001)"]


## Write To LateX
# 6. Write To LateX
#print('Write to latex')
e2L.write_to_latex(projet_name,filename,bird_list,col,condition_tableau, condition_rare, family, format, spacing, info)
#os.chdir('latex'); os.system(projet_name+'.tex');os.chdir('..')


## Run Latex
#print('Run pdflatex and open')
# 7. Run Latex
# print('Run pdflatex and open')
os.system('pdflatex -output-directory=./latex/ ./latex/'+ filename + '.tex ')
# os.system('pdflatex -output-directory=./latex/ ./latex/'+ filename + '.tex > /dev/null 2>&1')
# os.system('"start '+ filename + '.pdf"')
#os.chdir('..')
14 changes: 6 additions & 8 deletions script_list_e2L.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/usr/bin/env python
import os
import sys
import urllib.parse
import subprocess
import e2L
import json

with open('auth.json') as f:
auth = json.load(f)
session = e2L.auth(auth['username'], auth['password'])

# 1. Authentify
# Sesssion is required to download barchart data
session = e2L.auth('rafnuss','12468935')

# https://api.ebird.org/v2/ref/hotspot/PR
listHotspot = ['L358880','L323780','L323787','L293471','L802780','L323797','L341846','L323795','L343336','L294049','L293340','L420854','L323805','L323786','L323799','L293226','L293474','L550396','L682838','L341215','L323798','L293452','L527077','L682443','L323789','L323796','L323792','L813486','L340971']
Expand All @@ -23,13 +22,12 @@
target_loc = "world"
target_time = "life"

format='letterpaper,margin=.3in,twocolumn' #'a4paper,margin=15mm,twocolumn'
format='letterpaper,margin=.3in,twocolumn'
family = False
spacing = '.95'
condition_tableau = ['Main table display only non-hybrid birds with occurence >1\\%.'," ( bird['freq']['year'] >= 0.01)"]
condition_rare = ['\\footnotesize{>.1\\%}'," (bird['freq']['year'] < .00) and (bird['freq']['year'] > 0.001)"]

# create project metadata
for i,h in enumerate(listHotspot):
projet_name = listHospotName[i]
filename = projet_name.replace(' ','_').replace("'",'').replace('.','')
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
setup(
# the name must match the folder name 'verysimplemodule'
name="e2L",
version='0.0.3',
version='0.1.0',
license='MIT',
author="Raphaël Nussbaumer",
author_email="<rafnuss@gmail.com>",
Expand All @@ -13,7 +13,7 @@
url="https://github.com/Zoziologie/ebird2latex",
download_url="https://github.com/Zoziologie/ebird2latex/archive/refs/tags/v0.0.3.tar.gz",
py_modules=["e2L"],
install_requires=['requests'],
install_requires=['requests','re','lxml'],

keywords=['python', 'eBird', 'LaTeX'],
classifiers= [
Expand Down

0 comments on commit ce4d4ff

Please sign in to comment.