<commit_before># -----------------------------------------------------------------------------
# User configuration
# -----------------------------------------------------------------------------

outputDir = '/Volumes/KSW-Data/tonic/mpas-contours-sorted-composite/'
inputFile = '/Volumes/KSW-Data/Data/DataExploration/Data/MPAS/data/xyz_n_primal/X_Y_Z_NLAYER-primal_%d_0.vtu'
earthCore = '/Volumes/KSW-Data/Data/vtk/mpas/earth/earth-ok.vtk'

phi   = range(0, 360, 30)
theta = range(-60, 61, 30)
time  = range(50, 5151, 50)

dataRanges = {
    'bottomDepth': [-9753, 5984],
    'salinity': [24.8574, 37.4595],
    'temperature': [-1.64296, 28.6918]
}

# -----------------------------------------------------------------------------

from paraview import simple
from tonic.paraview.dataset_builder import *

# -----------------------------------------------------------------------------
# Pipeline creation
# -----------------------------------------------------------------------------

core = simple.OpenDataFile(earthCore)
coreSurface = simple.ExtractSurface(Input=core)
coreWithNormals = simple.GenerateSurfaceNormals(Input=coreSurface)

reader = simple.OpenDataFile(inputFile % time[0])
reader.CellArrayStatus = ['temperature', 'salinity']

dataCleanUp  = simple.Threshold(Input = reader, Scalars = ['CELLS', 'temperature'], ThresholdRange = [-1000.0, 50.0])
dataToPoints = simple.CellDatatoPointData(Input = dataCleanUp)

sceneDescription = {
    'size': [500, 500],
    'light': [ 'intensity', 'normal' ],
    'camera': {
        'CameraViewUp': [0.0, 0.0, 1.0],
        'CameraPosition': [107823.5, -46073770.81765442, -44044.25],
        'CameraFocalPoint': [107823.5, -7766.0, -44044.25]
    },
    'scene': [
        {
            'name': 'Earth',
            'source': coreWithNormals,
            'colors': {
                'bottomDepth': {'location': 'POINT_DATA', 'range': dataRanges['bottomDepth'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '5\ua8451',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [5.0]),
            'colors': {
                'temperature': {'constant': 5.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '10\ua8451',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [10.0]),
            'colors': {
                'temperature': {'constant': 10.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '15\ua8451',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [15.0]),
            'colors': {
                'temperature': {'constant': 15.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '20\ua8451',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [20.0]),
            'colors': {
                'temperature': {'constant': 20.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '25\ua8451',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [25.0]),
            'colors': {
                'temperature': {'constant': 25.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        }
    ]
}

# -----------------------------------------------------------------------------
# Data Generation
# -----------------------------------------------------------------------------

# Create Image Builder
dsb = CompositeDataSetBuilder(outputDir, sceneDescription, {'type': 'spherical', 'phi': phi, 'theta': theta})

dsb.start()
for t in time:
    reader.FileName = inputFile % t
    dsb.writeData()
dsb.stop()
<commit_msg>Fix mpas export script with proper time<commit_after># -----------------------------------------------------------------------------
# User configuration
# -----------------------------------------------------------------------------

outputDir = '/Volumes/KSW-Data/tonic/mpas-contours-sorted-composite/'
inputFile = '/Volumes/KSW-Data/Data/DataExploration/Data/MPAS/data/xyz_n_primal/X_Y_Z_NLAYER-primal_%d_0.vtu'
earthCore = '/Volumes/KSW-Data/Data/vtk/mpas/earth/earth-ok.vtk'

phi   = range(0, 360, 30)
theta = range(-60, 61, 30)
time  = range(50, 5151, 50)

dataRanges = {
    'bottomDepth': [-9753, 5984],
    'salinity': [24.8574, 37.4595],
    'temperature': [-1.64296, 28.6918]
}

# -----------------------------------------------------------------------------

from paraview import simple
from tonic.paraview.dataset_builder import *

# -----------------------------------------------------------------------------
# Pipeline creation
# -----------------------------------------------------------------------------

core = simple.OpenDataFile(earthCore)
coreSurface = simple.ExtractSurface(Input=core)
coreWithNormals = simple.GenerateSurfaceNormals(Input=coreSurface)

reader = simple.OpenDataFile(inputFile % time[0])
reader.CellArrayStatus = ['temperature', 'salinity']

dataCleanUp  = simple.Threshold(Input = reader, Scalars = ['CELLS', 'temperature'], ThresholdRange = [-1000.0, 50.0])
dataToPoints = simple.CellDatatoPointData(Input = dataCleanUp)

sceneDescription = {
    'size': [500, 500],
    'light': [ 'intensity', 'normal' ],
    'camera': {
        'CameraViewUp': [0.0, 0.0, 1.0],
        'CameraPosition': [107823.5, -46073770.81765442, -44044.25],
        'CameraFocalPoint': [107823.5, -7766.0, -44044.25]
    },
    'scene': [
        {
            'name': 'Earth',
            'source': coreWithNormals,
            'colors': {
                'bottomDepth': {'location': 'POINT_DATA', 'range': dataRanges['bottomDepth'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '5&#8451;',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [5.0]),
            'colors': {
                'temperature': {'constant': 5.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '10&#8451;',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [10.0]),
            'colors': {
                'temperature': {'constant': 10.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '15&#8451;',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [15.0]),
            'colors': {
                'temperature': {'constant': 15.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '20&#8451;',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [20.0]),
            'colors': {
                'temperature': {'constant': 20.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        },{
            'parent': 'Temperatures',
            'name': '25&#8451;',
            'source': simple.Contour(
                            Input = dataToPoints,
                            PointMergeMethod = "Uniform Binning",
                            ContourBy = 'temperature',
                            Isosurfaces = [25.0]),
            'colors': {
                'temperature': {'constant': 25.0 },
                'salinity': {'location': 'POINT_DATA', 'range': dataRanges['salinity'] }
            }
        }
    ]
}

# -----------------------------------------------------------------------------
# Data Generation
# -----------------------------------------------------------------------------

# Create Image Builder
dsb = CompositeDataSetBuilder(outputDir, sceneDescription, {'type': 'spherical', 'phi': phi, 'theta': theta})

# Add time information
dsb.getDataHandler().registerArgument(priority=1, name='time', values=time, ui='slider', loop='modulo')

dsb.start()
for t in dsb.getDataHandler().time:
    reader.FileName = inputFile % t
    dsb.writeData()
dsb.stop()

{'fraction_non_alphanumeric': 0.23758269971363682, 'fraction_numerical': 0.03564727954971857, 'mean_word_length': 1.3028649386084583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5828261', 'n_tokens_mistral': 2905, 'n_tokens_neox': 2648, 'n_words': 492}