Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify travis build #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
50 changes: 30 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
language: python
python:
- "3.5"
install:
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
sudo: required

- conda config --add channels conda-forge
- conda config --add channels bioconda
- conda config --set always_yes yes --set changeps1 no
- conda config --set show_channel_urls True
dist: bionic

- ENV_NAME='testing'
- conda create --quiet -n $ENV_NAME python=$TRAVIS_PYTHON_VERSION
- source activate $ENV_NAME
- conda install --quiet --file requirements.txt
- conda list
- conda info -a
language: python
- "3.6"
install:
- sudo apt-get install python3-h5py
- sudo apt-get install hdf5-helpers hdf5-tools
- sudo apt-get install libhdf5-dev
- dpkg -L libhdf5-dev
- sudo apt-get install python3-requests
- sudo apt-cache search netcdf
- sudo apt-get install libnetcdf-dev
- sudo apt-get install netcdf-bin
- sudo apt-get install python3-jinja2
- sudo apt-get install python3-six
- sudo apt-get install python3-pip
- sudo pip3 install setuptools --upgrade
- sudo pip3 install pyparsing
- sudo pip3 install rdflib
- export HDF5_DIR=/usr/include/hdf5
- export USE_SETUPCFG=0
- export HDF5_INCDIR=/usr/include
- export HDF5_LIBDIR=/usr/lib/x86_64-linux-gnu
- sudo pip3 install netCDF4
- wget https://github.com/marqh/terra/archive/master.zip
- unzip master.zip
- cd terra-master
- python setup.py --quiet install
- sudo python3 setup.py --quiet install
- cd ..
- python setup.py --quiet install
- sudo python3 setup.py --quiet install
- python3 -c 'import bald; print(bald); print(bald.__version__)'
- which python3
- python3 -c "import numpy; print('numpy: ' + numpy.__version__); import netCDF4; print('netCDF4: ' + netCDF4.__version__); print('###')"

script:
python -m unittest discover -s bald.tests -v
python3 -m unittest discover -s bald.tests -v
13 changes: 9 additions & 4 deletions lib/bald/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,21 @@ def __getitem__(self, item):
if not self.is_http_uri(item):
raise ValueError('{} is not a HTTP URI.'.format(item))
if item not in self.cache:
# null response, as a fall back
self.cache[item] = requests.models.Response()
# now = time.time()
try:
# print('trying: {}'.format(item))

headers = {'Accept': 'application/rdf+xml'}
self.cache[item] = requests.get(item, headers=headers, timeout=11)
except Exception:
# print('retrying: {}'.format(item))
headers = {'Accept': 'text/html'}
self.cache[item] = requests.get(item, headers=headers, timeout=11)
try:
# print('retrying: {}'.format(item))
headers = {'Accept': 'text/html'}
self.cache[item] = requests.get(item, headers=headers, timeout=11)
except Exception:
pass

# print('in {} seconds'.format(time.time() - then))
return self.cache[item]
Expand Down Expand Up @@ -577,7 +582,7 @@ def rdfgraph(self):
"""
graph = rdflib.Graph()
graph.bind('bald', 'http://binary-array-ld.net/latest/')
graph.bind('ns1', self.baseuri + '/')
graph.bind('this', self.baseuri + '/')
for prefix_name in self.prefixes():

#strip the double underscore suffix
Expand Down
1 change: 1 addition & 0 deletions lib/bald/tests/integration/CDL/array_geo.cdl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ variables:
prefix_list:rdf__ = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ;
prefix_list:rdfs__ = "http://www.w3.org/2000/01/rdf-schema#" ;
prefix_list:cf__ = "http://def.scitools.org.uk/CFTerms/" ;
prefix_list:nc__ = "http://def.scitools.org.uk/NetCDF/" ;
prefix_list:geo__ = "http://www.opengis.net/ont/geosparql#" ;
prefix_list:nc__ = "http://def.scitools.org.uk/NetCDF/" ;

Expand Down
1 change: 1 addition & 0 deletions lib/bald/tests/integration/CDL/array_multitypes.cdl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ variables:
prefix_list:rdf__ = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ;
prefix_list:rdfs__ = "http://www.w3.org/2000/01/rdf-schema#" ;
prefix_list:cf__ = "http://def.scitools.org.uk/CFTerms/" ;
prefix_list:nc__ = "http://def.scitools.org.uk/NetCDF/" ;
prefix_list:geo__ = "http://www.opengis.net/ont/geosparql#" ;
prefix_list:nc__ = "http://def.scitools.org.uk/NetCDF/" ;

Expand Down
86 changes: 43 additions & 43 deletions lib/bald/tests/integration/TTL/GEMS_CO2_Apr2006.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
@prefix NetCDF: <http://def.scitools.org.uk/NetCDF/> .
@prefix bald: <http://binary-array-ld.net/latest/> .
@prefix cf_sname: <http://vocab.nerc.ac.uk/standard_name/> .
@prefix ns1: <file://CDL/GEMS_CO2_Apr2006.cdl/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix this: <file://CDL/GEMS_CO2_Apr2006.cdl/> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<file://CDL/GEMS_CO2_Apr2006.cdl> a bald:Container ;
bald:contains ns1:co2,
ns1:co2_latitude_ref,
ns1:co2_levelist_ref,
ns1:co2_time_ref,
ns1:latitude,
ns1:levelist,
ns1:lnsp,
ns1:lnsp_latitude_ref,
ns1:lnsp_levelist_ref,
ns1:lnsp_time_ref,
ns1:longitude,
ns1:time ;
bald:contains this:co2,
this:co2_latitude_ref,
this:co2_levelist_ref,
this:co2_time_ref,
this:latitude,
this:levelist,
this:lnsp,
this:lnsp_latitude_ref,
this:lnsp_levelist_ref,
this:lnsp_time_ref,
this:longitude,
this:time ;
NetCDF:Conventions "CF-1.0" .

ns1:co2 a bald:Array ;
bald:references ns1:co2_latitude_ref,
ns1:co2_levelist_ref,
ns1:co2_time_ref,
ns1:longitude ;
this:co2 a bald:Array ;
bald:references this:co2_latitude_ref,
this:co2_levelist_ref,
this:co2_time_ref,
this:longitude ;
bald:shape "(1, 60, 181, 360)" ;
CFTerms:missing_value "-32767" ;
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/mass_fraction_of_carbon_dioxide_in_air/> ;
Expand All @@ -37,77 +37,77 @@ ns1:co2 a bald:Array ;
NetCDF:scale_factor 0.000981685145029486 ;
NetCDF:units "kg kg**-1" .

ns1:lnsp a bald:Array ;
bald:references ns1:lnsp_latitude_ref,
ns1:lnsp_levelist_ref,
ns1:lnsp_time_ref,
ns1:longitude ;
this:lnsp a bald:Array ;
bald:references this:lnsp_latitude_ref,
this:lnsp_levelist_ref,
this:lnsp_time_ref,
this:longitude ;
bald:shape "(1, 60, 181, 360)" ;
CFTerms:missing_value "-32767" ;
NetCDF:FillValue "-32767" ;
NetCDF:add_offset 11.2087164280841 ;
NetCDF:long_name "Logarithm of surface pressure" ;
NetCDF:scale_factor 1.03952457840347e-05 .

ns1:co2_latitude_ref a bald:Reference,
this:co2_latitude_ref a bald:Reference,
bald:Subject ;
bald:array ns1:latitude ;
bald:array this:latitude ;
bald:childBroadcast "(1, 1, 181, 1)" .

ns1:co2_levelist_ref a bald:Reference,
this:co2_levelist_ref a bald:Reference,
bald:Subject ;
bald:array ns1:levelist ;
bald:array this:levelist ;
bald:childBroadcast "(1, 60, 1, 1)" .

ns1:co2_time_ref a bald:Reference,
this:co2_time_ref a bald:Reference,
bald:Subject ;
bald:array ns1:time ;
bald:array this:time ;
bald:childBroadcast "(1, 1, 1, 1)" .

ns1:lnsp_latitude_ref a bald:Reference,
this:lnsp_latitude_ref a bald:Reference,
bald:Subject ;
bald:array ns1:latitude ;
bald:array this:latitude ;
bald:childBroadcast "(1, 1, 181, 1)" .

ns1:lnsp_levelist_ref a bald:Reference,
this:lnsp_levelist_ref a bald:Reference,
bald:Subject ;
bald:array ns1:levelist ;
bald:array this:levelist ;
bald:childBroadcast "(1, 60, 1, 1)" .

ns1:lnsp_time_ref a bald:Reference,
this:lnsp_time_ref a bald:Reference,
bald:Subject ;
bald:array ns1:time ;
bald:array this:time ;
bald:childBroadcast "(1, 1, 1, 1)" .

ns1:latitude a bald:Array,
this:latitude a bald:Array,
bald:Reference ;
bald:array ns1:latitude ;
bald:array this:latitude ;
bald:first_value 90.0 ;
bald:last_value -90.0 ;
bald:shape "(181,)" ;
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/latitude/> ;
NetCDF:units "degrees_north" .

ns1:levelist a bald:Array,
this:levelist a bald:Array,
bald:Reference ;
bald:array ns1:levelist ;
bald:array this:levelist ;
bald:first_value 1 ;
bald:last_value 60 ;
bald:shape "(60,)" ;
NetCDF:long_name "model_level_number" .

ns1:longitude a bald:Array,
this:longitude a bald:Array,
bald:Reference ;
bald:array ns1:longitude ;
bald:array this:longitude ;
bald:first_value 0.0 ;
bald:last_value 359.0 ;
bald:shape "(360,)" ;
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/longitude/> ;
NetCDF:units "degrees_east" .

ns1:time a bald:Array,
this:time a bald:Array,
bald:Reference ;
bald:array ns1:time ;
bald:array this:time ;
bald:first_value "2006-04-01T00:00:00"^^xsd:dateTime ;
bald:shape "(1,)" ;
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/time/> ;
Expand Down
26 changes: 13 additions & 13 deletions lib/bald/tests/integration/TTL/ProcessChain0300.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
@prefix StatPP: <https://codes.nws.noaa.gov/StatisticalPostProcessing> .
@prefix bald: <http://binary-array-ld.net/latest/> .
@prefix cf_sname: <http://vocab.nerc.ac.uk/standard_name/> .
@prefix ns1: <file://CDL/ProcessChain0300.cdl/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix this: <file://CDL/ProcessChain0300.cdl/> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<file://CDL/ProcessChain0300.cdl> a bald:Container ;
ns1:process_chain "gfsmos_process_chain" ;
bald:contains ns1:gfsmos_process_chain,
ns1:step1,
ns1:step2 ;
this:process_chain "gfsmos_process_chain" ;
bald:contains this:gfsmos_process_chain,
this:step1,
this:step2 ;
bald:isPrefixedBy "prefix_list" .

ns1:gfsmos_process_chain a bald:Subject ;
ns1:OM_Process ( ns1:step1 ns1:step2 ) .
this:gfsmos_process_chain a bald:Subject ;
this:OM_Process ( this:step1 this:step2 ) .

ns1:step1 a bald:Subject ;
ns1:LE_ProcessStep <https://codes.nws.noaa.gov/NumericalWeatherPrediction/Models/GFS13> ;
ns1:LE_Source <https://codes.nws.noaa.gov/DataAssimilation/Methods/GDAS13> .
this:step1 a bald:Subject ;
this:LE_ProcessStep <https://codes.nws.noaa.gov/NumericalWeatherPrediction/Models/GFS13> ;
this:LE_Source <https://codes.nws.noaa.gov/DataAssimilation/Methods/GDAS13> .

ns1:step2 a bald:Subject ;
ns1:LE_ProcessStep <https://codes.nws.noaa.gov/StatisticalPostProcessing/Methods/GFSMOS05> ;
ns1:LE_Source <https://codes.nws.noaa.gov/NumericalWeatherPrediction/Models/GFS13> .
this:step2 a bald:Subject ;
this:LE_ProcessStep <https://codes.nws.noaa.gov/StatisticalPostProcessing/Methods/GFSMOS05> ;
this:LE_Source <https://codes.nws.noaa.gov/NumericalWeatherPrediction/Models/GFS13> .

14 changes: 7 additions & 7 deletions lib/bald/tests/integration/TTL/array_reference.ttl
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
@prefix bald: <http://binary-array-ld.net/latest/> .
@prefix ns1: <file://CDL/array_reference.cdl/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix this: <file://CDL/array_reference.cdl/> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<file://CDL/array_reference.cdl> a bald:Container ;
bald:contains ns1:child_variable,
ns1:parent_variable ;
bald:contains this:child_variable,
this:parent_variable ;
bald:isPrefixedBy "prefix_list" .

ns1:parent_variable a bald:Array ;
bald:references ns1:child_variable ;
this:parent_variable a bald:Array ;
bald:references this:child_variable ;
bald:shape "(11, 17)" .

ns1:child_variable a bald:Array,
this:child_variable a bald:Array,
bald:Reference ;
bald:array ns1:child_variable ;
bald:array this:child_variable ;
bald:shape "(11, 17)" .

14 changes: 7 additions & 7 deletions lib/bald/tests/integration/TTL/array_reference_withbase.ttl
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
@prefix bald: <http://binary-array-ld.net/latest/> .
@prefix ns1: <http://example.org/base/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix this: <http://example.org/base/> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.org/base> a bald:Container ;
bald:contains ns1:child_variable,
ns1:parent_variable ;
bald:contains this:child_variable,
this:parent_variable ;
bald:isPrefixedBy "prefix_list" .

ns1:parent_variable a bald:Array ;
bald:references ns1:child_variable ;
this:parent_variable a bald:Array ;
bald:references this:child_variable ;
bald:shape "(11, 17)" .

ns1:child_variable a bald:Array,
this:child_variable a bald:Array,
bald:Reference ;
bald:array ns1:child_variable ;
bald:array this:child_variable ;
bald:shape "(11, 17)" .

Loading