In [1]:
import jpkfile
jpk = jpkfile.JPKFile("force-save-2016.07.05-10.00.50.062.jpk-nt-force")
if jpk.has_shared_header:
    print("This JPKFile has a shared header!")


WARNING! Did not find encoder parameters for channel trapDistance!
This JPKFile has a shared header!
WARNING! Did not find encoder parameters for channel trapDistance!
  • Some JPK archives have a shared header.
  • How to replace links to parameters from local header to shared header with actual parameters?

In [6]:
def find_link(parameter_subset,link_keys,chain):
    print "==== loop starting with chain ",chain
    for key in parameter_subset:
        print "==== ==== processing key ",key
        copy_chain = chain[:]
        copy_chain.append(key)
        if key in link_keys:
            print "==== ==== ==== identified key as link"
            return copy_chain
        else:
            if isinstance(parameter_subset[key],dict):
                print "==== ==== ==== key is no link and value is dict" 
                return find_link(parameter_subset[key],link_keys,copy_chain)
            else:
                print "==== ==== ==== key is no link, value is no dict --> aborting"
                return None

In [7]:
links = find_link(jpk.segments[0].parameters, jpk.shared_parameters.keys(),[])


==== loop starting with chain  []
==== ==== processing key  date
==== ==== ==== identified key as link

In [ ]:


In [ ]:


In [2]:
l = [6,2,12]
a = l[:]
a[0]=1
print l
print a


[6, 2, 12]
[1, 2, 12]

In [ ]: