예제 #1
0
                        else:
                            (i, j, k), interpolator = point_interpolator
                            int_value = settings.FMT_FLOAT.format(
                                interpolator.dot(var[[i, j, k]]))
                            if args.long:
                                csvwriter.writerow(values_long +
                                                   [var_ID, int_value])
                            else:
                                values.append(int_value)

                if not args.long: csvwriter.writerow(values)


parser = PyTelToolsArgParse(description=__doc__, add_args=['in_slf'])
parser.add_argument('in_points', help='set of points file (*.shp)')
parser.add_known_argument('out_csv')
parser.add_argument(
    '--long',
    help=
    'write CSV with long format (variables are also in rows) instead of wide format',
    action='store_true')
parser.add_argument(
    '--vars',
    nargs='+',
    help='variable(s) to extract (by default: every variables)',
    default=None,
    metavar=('VA', 'VB'))
parser.add_group_general(['force', 'verbose'])

if __name__ == '__main__':
    args = parser.parse_args()
예제 #2
0
                    if (n1, n2, n3) != ikle[j]:
                        raise RuntimeError("Mesh is not strictly identical")

            if i == 0:
                output_header = Serafin.SerafinHeader(
                    title='Converted from LandXML (written by PyTelTools)')
                output_header.from_triangulation(
                    np.array(nodes, dtype=np.int64),
                    np.array(ikle, dtype=np.int64))
                output_header.add_variable_str(varname, varname, '')
                resout.write_header(output_header)

            time = i * 3600.0  # FIXME: should convert time_duration to float
            resout.write_entire_frame(output_header, time,
                                      np.expand_dims(np.array(values), axis=0))


parser = PyTelToolsArgParse(description=__doc__)
parser.add_argument('in_xml', help='input LandXML file (with .xml extension)')
parser.add_known_argument('out_slf')
parser.add_group_general(['force', 'verbose'])

if __name__ == '__main__':
    args = parser.parse_args()

    try:
        landxml_to_slf(args)
    except (Serafin.SerafinRequestError, Serafin.SerafinValidationError):
        # Message is already reported by slf logger
        sys.exit(1)