Пример #1
0
def get_data_offline():
    try:
        pmag_dir = check_updates.get_pmag_dir()
        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
Пример #2
0
 def on_helpButton(self, event):
     #for use on the command line
     path = check_updates.get_pmag_dir()
     
     # for use with pyinstaller:
     #path = self.Parent.resource_dir
     
     html_frame = pw.HtmlFrame(self, page=(os.path.join(path, "help_files", "ErMagicHeadersHelp.html")))
     html_frame.Center()
     html_frame.Show()
Пример #3
0
    def on_helpButton(self, event, page=None):
        """shows html help page"""
        # for use on the command line:
        path = check_updates.get_pmag_dir()

        # for use with pyinstaller
        #path = self.main_frame.resource_dir

        html_frame = pw.HtmlFrame(self, page=(os.path.join(path, 'help_files', page)))
        html_frame.Show()
Пример #4
0
def get_data_offline():
    try:
        pmag_dir = check_updates.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
Пример #5
0
 def on_help(self, event):
     """
     point user to Cookbook help
     """
     #for use on the command line
     path = check_updates.get_pmag_dir()
     
     # for use with pyinstaller:
     #path = self.Parent.resource_dir
     
     html_frame = pw.HtmlFrame(self, page=(os.path.join(path, "documentation", "make_magic.html")))
     html_frame.Center()
     html_frame.Show()
#!/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
# get list of controlled vocabularies form this part of the api:
#'http://api.earthref.org/MagIC/vocabularies.json'
# then, use that list to determine whether or not any given column has a controlled vocabulary list
import check_updates
pmag_dir = check_updates.get_pmag_dir()

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_meth_codes(self):
        """
        Get method codes from the MagIC API
        """
        try:
            raw_codes = pd.io.json.read_json('https://api.earthref.org/MagIC/method_codes.json')
Пример #7
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
# get list of controlled vocabularies form this part of the api:
#'http://api.earthref.org/MagIC/vocabularies.json'
# then, use that list to determine whether or not any given column has a controlled vocabulary list
import check_updates
pmag_dir = check_updates.get_pmag_dir()


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_meth_codes(self):
        """
        Get method codes from the MagIC API
        """
        try:
            raw_codes = pd.io.json.read_json(