Example #1
0
def get_data_offline():
    try:
        pmag_dir = find_pmag_dir.get_pmag_dir()
        the_file = os.path.join(pmag_dir, 'pmagpy', 'data_model', "MagIC-data-model.txt")
        # if using with py2app, the directory structure is flat,
        # so check to see where the resource actually is
        if not os.path.exists(the_file):
            the_file = os.path.join(pmag_dir, 'data_model', 'MagIC-data-model.txt')
        data = open(the_file, 'rU')
        return data
    except IOError:
        print "can't access MagIC-data-model at the moment\nif you are working offline, make sure MagIC-data-model.txt is in your PmagPy directory (or download it from https://github.com/ltauxe/PmagPy and put it in your PmagPy directory)\notherwise, check your internet connection"
        return False
def get_data_offline():
    try:
        pmag_dir = find_pmag_dir.get_pmag_dir()
        the_file = os.path.join(pmag_dir, 'pmagpy', 'data_model', "MagIC-data-model.txt")
        # if using with py2app, the directory structure is flat,
        # so check to see where the resource actually is
        if not os.path.exists(the_file):
            the_file = os.path.join(pmag_dir, 'data_model', 'MagIC-data-model.txt')
        data = open(the_file, 'rU')
        return data
    except IOError:
        print "can't access MagIC-data-model at the moment\nif you are working offline, make sure MagIC-data-model.txt is in your PmagPy directory (or download it from https://github.com/ltauxe/PmagPy and put it in your PmagPy directory)\notherwise, check your internet connection"
        return False
Example #3
0
#!/usr/bin/env python
import pandas as pd
from pandas import Series, DataFrame
import urllib2
import httplib
import json
import os
#import backup_vocabulary as backup
import find_pmag_dir
import data_model3
pmag_dir = find_pmag_dir.get_pmag_dir()
data_model_dir = os.path.join(pmag_dir, 'pmagpy', 'data_model')
# if using with py2app, the directory structure is flat,
# so check to see where the resource actually is
if not os.path.exists(data_model_dir):
    data_model_dir = os.path.join(pmag_dir, 'data_model')


class Vocabulary(object):
    def __init__(self):
        self.vocabularies = []
        self.possible_vocabularies = []
        self.all_codes = []
        self.code_types = []
        self.methods = []
        self.age_methods = []

    ## Get method codes

    def get_meth_codes(self):
        try:
#!/usr/bin/env python
import pandas as pd
from pandas import Series
import json
import os
import find_pmag_dir
pmag_dir = find_pmag_dir.get_pmag_dir()
data_model_dir = os.path.join(pmag_dir, 'pmagpy', 'data_model')
# if using with py2app, the directory structure is flat,
# so check to see where the resource actually is
if not os.path.exists(data_model_dir):
    data_model_dir = os.path.join(pmag_dir, 'data_model')


class Vocabulary(object):

    def __init__(self):
        self.vocabularies = []
        self.possible_vocabularies = []
        self.all_codes = []
        self.code_types = []
        self.er_methods = []
        self.pmag_methods = []
        self.age_methods = []

    def get_one_meth_type(self, mtype, method_list):
        """
        Get all codes of one type (i.e., 'anisotropy_estimation')
        """
        cond = method_list['dtype'] == mtype
        codes = method_list[cond]