Skip to content

Instantly share code, notes, and snippets.

View lukecampbell's full-sized avatar

Luke Campbell lukecampbell

View GitHub Profile
diff --git a/pyon/datastore/test/test_datastores.py b/pyon/datastore/test/test_datastores.py
index d3f0d38..9a6fd96 100644
--- a/pyon/datastore/test/test_datastores.py
+++ b/pyon/datastore/test/test_datastores.py
@@ -211,7 +211,6 @@ class Test_DataStores(IonIntegrationTestCase):
#data_set.variables = [
# {"name":"water_height", "value":"ft"}
#]
- data_set.contact.name = "Heitor Villa-Lobos"
# IPython log file
from ion.services.dm.utility.granule_utils import *
pdict = ParameterDictionary()
tc = ParameterContext('time', param_type=QuantityType(value_encoding=np.uint64))
tc.reference_frame = AxisTypeEnum.TIME
data = ParameterContext('data', param_type=QuantityType(value_encoding=np.uint64))
pdict.add_context(tc)
pdict.add_context(data)
stream0, stream1 = [pn.pubsub_management.create_stream() for i in xrange(2)]
@lukecampbell
lukecampbell / perftest.py
Created August 17, 2012 15:18
Performance testing for rtree
#!/usr/bin/env python
"""
from test import dorun
dorun()
dorun(100)
dorun(1000)
"""
def dorun(cnt=10, pheader=False):
@lukecampbell
lukecampbell / iq_list.r
Created August 21, 2012 03:14
Probability Density Function in R
# Children's IQ scores are normally distributed with a
# mean of 100 and a standard deviation of 15. What
# proportion of children are expected to have an IQ between
# 80 and 120?
mean=100; sd=15
lb=80; ub=120
x <- seq(-4,4,length=100)*sd + mean
hx <- dnorm(x,mean,sd)
@lukecampbell
lukecampbell / coverage.md
Created August 21, 2012 17:23
Coverage Discussion

Coverage

Disclaimer

All in all coverage is exactly where it should be which is why this document is knit-picking and short.

Concurrent Ingestion Problem


Header 1

Header 2

Header 3 ### (Hashes on right are optional)

Header 4

Header 5

Markdown plus h2 with a custom ID ## {#id-goes-here}

Link back to H2

This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one

ion.services.ans.test.test_workflow: DEBUG: Starting test_transform_workflow
ion.services.ans.test.test_helper: DEBUG: Create data process definition SalinityTransform
ion.services.ans.test.test_helper: DEBUG: Create data process definition SalinityDoublerTransform
ion.services.ans.test.test_helper: DEBUG: Creating new CDM data product with a stream definition: ctd_parsed
ion.services.ans.test.test_helper: DEBUG: new ctd_parsed_data_product_id = 48a1b96b190f47fe8a3f4f30f70514cb
ion.services.sa.product.data_product_management_service: DEBUG: Activating data product persistence for stream_id: 1b9796adf6d14293ac6cdccb2b8786b2
ion.services.sa.product.data_product_management_service: DEBUG: Found the following datasets: ['50d3103f40c1414a85369843e81b49d3'], for the data product: 48a1b96b190f47fe8a3f4f30f70514cb
ion.services.sa.product.data_product_management_service: DEBUG: Activating data product persistence for dataset_id: 50d3103f40c1414a85369843e81b49d3
ion.services.sa.product.data_product_management_service:
@lukecampbell
lukecampbell / container1.py
Created August 30, 2012 18:21
Datastore problem
____ ________ _ __ ____________ ____ ___
/ __ \__ ______ ____ / _/ __ \/ | / / / ____/ ____/ / __ \|__ \
/ /_/ / / / / __ \/ __ \ ______ / // / / / |/ / / / / / / /_/ /__/ /
/ ____/ /_/ / /_/ / / / / /_____/ _/ // /_/ / /| / / /___/ /___ / _, _// __/
/_/ \__, /\____/_/ /_/ /___/\____/_/ |_/ \____/\____/ /_/ |_|/____/
/____/
Pyon - ION R2 CC interactive IPython shell. Type ionhelp() for help
><> ds = cc.datastore_manager.get_datastore('filesystem','FILESYSTEM')
@lukecampbell
lukecampbell / reverse.py
Created September 5, 2012 19:15
Reverse BFS and deepest root node search.
def _parent_topics(self, topic_id):
nodes = [topic_id]
done=False
while not done:
parents, assocs = self.clients.resource_registry.find_subjects(object=topic_id, predicate=PRED.hasTopic, subject_type=RT.Topic, id_only=True)
if not parents:
done = True
else:
validate_equal(len(parents),1, 'Found a topic with more than one parent.')
topic_id = parents[0]
# IPython log file
from interface.objects import ProcessDefinition
procdef = ProcessDefinition()
procdef.name = 'simple'
procdef.executable = {'module': 'pyon.ion.process', 'class' : 'SimpleProcess' }
procdef_id = pn.process_dispatcher.create_process_definition(procdef)
pid = pn.process_dispatcher.create_process(process_definition_id=procdef_id)
def validate(*args, **kwargs):
print "the process has started"