def get_sigs_in_dir(directory, viname=None, searchstring='mean.ref', recursivesearch=False): signatures = signatureCollection(viName=viname) sigFiles = find_files(directory, searchstring, recursive=recursivesearch) for f in sigFiles: signatures.add(f) return signatures
def plot_sigs(signaturedirectory, outputdirectory, name, signaturename): """ """ import os from utils import find_files, unique_name from core import signatureCollection from plotting import SignaturePlot if not outputdirectory: outputdirectory = signaturedirectory sigs = find_files(signaturedirectory, "mean.ref") if not sigs: click.BadParameter("Did not find any signature files in the specified directory.") if signaturename: filteredsigs = [] for searchstring in signaturename: for sig in sigs: if searchstring.upper() in sig.upper(): filteredsigs.append(sig) sigs = filteredsigs signatures = signatureCollection() for sig in sigs: try: signatures.add(sig) except Exception as e: print e #TODO Fix core temporalSignature to use exceptions so they can be properly handled here name, ext = os.path.splitext(name) path = unique_name(outputdirectory, name, ext=ext) print("Outputting to {0}".format(path)) plot = SignaturePlot(outputdirectory, os.path.basename(path)) plot.plot_collection(signatures)
] # directory to search for sigs signaturedirectory = "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/Pellegrini/MODIS_10-13_6-14_resampled/Summer2014/multidate_image_aqua105/interpolatedband10/signatures_2014-08-24_0935/" # dir for output outputdir = "/Users/phoetrymaster/Documents/School/Geography/Thesis/ThesisTeX/plots/" #outputdir = "/Users/phoetrymaster/Documents/TeX/deletetest/plots" # plot name name = "othersigsAR.pgf" # find sigs in directory and add to sig collection sigs = find_files(signaturedirectory, "mean.ref") signatures = signatureCollection() for sig in sigs: try: signatures.add(sig) except Exception as e: print e # fonts and other formatting settings pgf_with_rc_fonts = {"pgf.texsystem": "/usr/texbin/xelatex", 'text.color': 'black', "font.family": "serif", "font.serif": ["/Library/Fonts/Baskerville.ttc"], "font.sans-serif": ["Myriad Pro"], 'font.size': 10,
signaturedirectory = "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/Refs/2012clip1test2/clip1/" oldsigdir = "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/Refs/2012/clip1/corn_NDVI_mean.ref" # dir for output outputdir = "/Users/phoetrymaster/Documents/School/Geography/Thesis/ThesisTeX/plots/" #outputdir = "/Users/phoetrymaster/Documents/TeX/deletetest/plots" # plot name name = "refinedsorghumKS.pgf" # find sigs in directory and add to sig collection meansigs = find_files(signaturedirectory, "mean.ref") meansignatures = signatureCollection() for sig in meansigs: try: meansignatures.add(sig) except Exception as e: print e pointsigs = find_files(signaturedirectory, "points.ref") pointsignatures = signatureCollection() for sig in pointsigs: signame = os.path.splitext(os.path.basename(sig))[0] values = parse_points_ref(sig)