i will have to move this to a new thread but...
the archive say "ceres_opnav5_128.txt.gz"
first is a Gziped archive
on windows the FREE tool 7-zip will open it just fine
on Linux use your DEFAULT archive manager ( file-roller/ ark) for your desktop- the format is built in and is a DEFAULT format
ceres_opnav5_128.txt is well a text file
read the accompanying readme
ftp://naif.jpl.nasa.gov/pub/naif/DAWN/m ... readme.txtand "read the code"
the shape file is a "plate model"
( but one with a BUG !!! so read the code ) a plate is 99.9% a Wavefront .obj format
you can use libreoffice Calc ( excel) or the below python script
the vertex numbers need to be replaced with a " v "
the face/plate numbers need to be replaced with a " f "
Code:
#!/usr/bin/env python
#Purpose: To convert SIMPLE PDS Plate-Vertex to Alias WaveFront OBJ
# Trent Hare, April 2013
import sys, os
def Usage():
print '''
This script converts a SIMPLE shapemodel Plate-Vertex to Alias Wavefront OBJ
Usage: %s <input.tab> <output.obj>
'''%sys.argv[0]
if len(sys.argv) < 3:
Usage()
sys.exit(0)
#Create the output datasource
try:
output = sys.argv[2]
except:
Usage()
sys.exit(1)
#Open the PDS tab file to read
try:
input = sys.argv[1]
except:
Usage()
sys.exit(1)
infile = open(input, 'r')
#Create an empty file
outfile = open(output, 'w')
#Loop through the input
i = 0
for line in infile:
if (i == 0):
nVerts, nFaces = line.split()
nVerts = int(nVerts)+1
nFaces = int(nFaces)
print line
else:
l1, l2, l3, l4 = line.split()
if i < int(nVerts):
outfile.write('v ' + l2 + ' ' + l3 + ' ' + l4 + '\n')
else:
outfile.write('f ' + l2 + ' ' + l3 + ' ' + l4 + '\n')
i = i + 1
print "Obj successfully created."
BUT
there is a minor BUG in the text file
the count for the FACES is NOT!!!!!! at the TOP of the file
It is at the START of the faces section
EXAMPLE for the 128
Code:
# --- the first TWO lines ---#
99846
1 -0.35222320000000002E+03 -0.74438670000000002E+02 0.29003088000000002E+03
2 -0.35092140999999998E+03 -0.69759749999999997E+02 0.29222390999999999E+03
# --- line number 99847 and 99848 and 99849 --- #
99846 -0.77744889999999998E+02 0.40905569000000003E+03 -0.23088568000000001E+03
196608
1 1 131 2
the number of plates "196608" NEEDS to be in the correct place at the TOP
like this
Code:
99846 196608
1 -0.35222320000000002E+03 -0.74438670000000002E+02 0.29003088000000002E+03
2 -0.35092140999999998E+03 -0.69759749999999997E+02 0.29222390999999999E+03
3 -0.34960442000000000E+03 -0.65077200000000005E+02 0.29439953000000003E+03
4 -0.34828456000000000E+03 -0.60394460000000002E+02 0.29657312999999999E+03
5 -0.34698140999999998E+03 -0.55715919999999997E+02 0.29876533000000001E+03
then run the python script
Code:
./pdsVertexTAB2obj.py ceres_opnav5_128.txt ceres_opnav5_128.obj