Ejemplo n.º 1
0
def RequestInformation(self):
    from paraview import util
    from PVGPpy.read import ubcExtent
    # Preview the mesh file and get the mesh extents
    ext = ubcExtent(FileName_Mesh)
    # Set the mesh extents
    util.SetOutputWholeExtent(self, ext)
Ejemplo n.º 2
0
def RequestInformation():
    import datetime
    from paraview import util
    sys.path.insert(0, r'EMC_SRC_PATH')
    import IrisEMC_Paraview_Lib as Lib

    Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End = Lib.get_area(
        Area, Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End)
    if not Time_End.strip():
        Time_End = datetime.datetime.today().strftime('%Y-%m-%d')
    query = Lib.earthquakeQuery % (Time_Begin, Time_End, Magnitude_Begin,
                                   Magnitude_End, Depth_Begin, Depth_End,
                                   Latitude_Begin, Latitude_End,
                                   Longitude_Begin, Longitude_End)

    Alternate_FileName = Alternate_FileName.strip()
    if len(Alternate_FileName) <= 0:
        eq_file = Lib.query2filename(query,
                                     url=Lib.earthquakeKeys[Data_Source])
        query = '?'.join([Lib.earthquakeKeys[Data_Source], query])
        file_found, address, source = Lib.find_file(
            eq_file, loc=r'EMC_EARTHQUAKES_PATH', query=query)
    else:
        file_found, address, source = Lib.find_file(
            Alternate_FileName, loc=r'EMC_EARTHQUAKES_PATH')
    if not file_found:
        raise Exception(
            'earthquake catalog file "' + address +
            '" not found! Please provide the full path or UR for the file. Aborting.'
        )
    (params, lines) = Lib.read_geocsv(address)
    num = len(lines)
    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, num - 1, 0, num - 1, 0, num - 1])
Ejemplo n.º 3
0
def RequestInformation():
    from paraview import util
    sys.path.insert(0, "EMC_SRC_PATH")
    import IrisEMC_Paraview_Lib as lib

    Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End = lib.getArea(
        Area, Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End)
    query = lib.earthquakeQuery % (Start_Time, Magnitude_Begin, Magnitude_End,
                                   Depth_Begin, Depth_End, Latitude_Begin,
                                   Latitude_End, Longitude_Begin,
                                   Longitude_End, Max_Count)
    if len(Alternate_FileName) <= 0:
        eqFile = lib.query2fileName(query, url=lib.earthquakeKeys[Data_Source])
        query = '?'.join([lib.earthquakeKeys[Data_Source], query])
        fileFound, address, source = lib.findFile(eqFile,
                                                  loc='EMC_EARTHQUAKES_PATH',
                                                  query=query)
    else:
        fileFound, address, source = lib.findFile(Alternate_FileName,
                                                  loc='EMC_EARTHQUAKES_PATH')
    if not fileFound:
        raise Exception(
            'earthquake catalog file "' + address +
            '" not found! Please provide the full path or UR for the file. Aborting.'
        )
    (params, lines) = lib.readGcsv(address)
    num = len(lines)
    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, num - 1, 0, num - 1, 0, num - 1])
Ejemplo n.º 4
0
def RequestInformation():
    from paraview import util
    import csv

    if FileName_Mesh == 'absolute path':
        raise Exception('No mesh file selected. Aborting.')

    # Read in the mesh and set up structure of output grid from mesh file input
    with open(FileName_Mesh) as f:
        reader = csv.reader(f, delimiter=Delimiter_Field)
        h = reader.next()
        # TODO: ignore header lines if start with '!'
        # Ignore header lines if start with '!'
        while h[0][0] == '!':
            h = reader.next()

        # Number of CELLS in each axial direction
        n1, n2, n3 = int(h[0]), int(h[1]), int(h[2])
        # change to number of POINTS in each axial direction
        n1, n2, n3 = n1 + 1, n2 + 1, n3 + 1

        # ABSOLUTELY NECESSARY FOR THE FILTER TO WORK:
        util.SetOutputWholeExtent(self, [0, n1 - 1, 0, n2 - 1, 0, n3 - 1])

        f.close()
def RequestInformation():
    from paraview import util
    from PVGPpy.filt import refoldidx
    # Setup the ImageData
    idx = refoldidx(SEPlib=SEPlib, swapXY=Transpose_XY)
    nx, ny, nz = extent[idx[0]], extent[idx[1]], extent[idx[2]]
    # ABSOLUTELY NECESSARY FOR THE FILTER TO WORK:
    util.SetOutputWholeExtent(self, [0, nx - 1, 0, ny - 1, 0, nz - 1])
Ejemplo n.º 6
0
def RequestInformation(self):
    from paraview import util
    from PVGPpy.read import setOutputTimesteps, readPVGPGridExtents
    # This is necessary to set time steps
    setOutputTimesteps(self, FileNames[0], dt=Time_Step)
    # NOTE: if using time series, they all must have the same extents
    ext = readPVGPGridExtents(FileNames[0])
    util.SetOutputWholeExtent(self, ext)
Ejemplo n.º 7
0
 def RequestInformation(self, request, inInfo, outInfo):
     logger.debug("Requesting information...")
     # For the `vtkUniformGrid` output we need to provide extents
     # so that it gets rendered at all.
     N = self.num_points_per_dim
     util.SetOutputWholeExtent(self, [0, N - 1, 0, N - 1, 0, N - 1])
     logger.debug(f"Information object: {outInfo.GetInformationObject(0)}")
     return 1
Ejemplo n.º 8
0
def RequestInformation():
    from paraview import util
    from PVGPpy.read import ubcExtent
    if FileName_Mesh == 'absolute path':
        raise Exception('No mesh file selected. Aborting.')
    # Preview the mesh file and get the mesh extents
    ext = ubcExtent(FileName_Mesh)
    # Set the mesh extents
    util.SetOutputWholeExtent(self, ext)
Ejemplo n.º 9
0
def RequestInformation():
    sys.path.insert(0, r'EMC_SRC_PATH')
    import IrisEMC_Paraview_Lib as lib
    from paraview import util
    from os.path import splitext
    import IrisEMC_Paraview_Utils as utils
    import IrisEMC_Paraview_Param as param

    depth_begin = float(Depth_begin)
    depth_end = float(Depth_end)
    File_name = File_name.strip()
    ext = None
    if File_name in list(param.filesDict.values()) or not (
            File_name.lower().endswith(param.filesExtDict['ssl'].lower())
            or File_name.lower().endswith(param.filesExtDict['geo'].lower())):
        if utils.support_nc():
            ext = param.filesExtDict['ssl']
        else:
            ext = param.filesExtDict['geo']

    fileFound, address, source = lib.find_file(File_name,
                                               loc=r'EMC_MODELS_PATH',
                                               ext=ext)
    if not fileFound:
        raise Exception('model file "' + address + '" not found! Aborting.')
    Latitude_begin, Latitude_end, Longitude_begin, Longitude_end = lib.get_area(
        Area, Latitude_begin, Latitude_end, Longitude_begin, Longitude_end)
    this_filename, extension = splitext(address)
    if extension.lower() == '.nc':
        nx, ny, nz = lib.read_netcdf_model(address,
                                           Latitude_variable,
                                           Longitude_variable,
                                           Depth_variable,
                                           (Latitude_begin, Longitude_begin),
                                           (Latitude_end, Longitude_end),
                                           depth_begin,
                                           depth_end,
                                           Vertical_Scaling,
                                           inc=Sampling,
                                           extent=True)
    else:
        try:
            nx, ny, nz = lib.read_geocsv_model_3d(
                address, (Latitude_begin, Longitude_begin),
                (Latitude_end, Longitude_end),
                depth_begin,
                depth_end,
                Vertical_Scaling,
                inc=Sampling,
                extent=True)
        except Exception:
            raise Exception('cannot recognize model file "' + address +
                            '"! Aborting.')

    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, nx, 0, ny, 0, nz])
Ejemplo n.º 10
0
def RequestInformation():
    from paraview import util
    # Setup the ImageData
    # Cartesian: d1=x, d2=y, d3=z
    nx, ny, nz = extent[0], extent[1], extent[2]
    if SEPlib:
        # SEPlib: d1=z, d2=x, d3=y
        nz, nx, ny = extent[0], extent[1], extent[2]
    # ABSOLUTELY NECESSARY FOR THE FILTER TO WORK:
    util.SetOutputWholeExtent(self, [0, nx - 1, 0, ny - 1, 0, nz - 1])
def RequestInformation():
    from paraview import util
    from PVGPpy.read import sgemsExtent, setOutputTimesteps, getTimeStepFileIndex
    # This is necessary to set time steps
    setOutputTimesteps(self, FileNames, dt=Time_Step)
    # Only grab extent for first file... requires all to have same extent
    ext = sgemsExtent(FileNames[0],
                      deli=Delimiter_Field,
                      useTab=Use_tab_delimiter)
    util.SetOutputWholeExtent(self, ext)
Ejemplo n.º 12
0
def RequestInformation():
    from paraview import util
    import csv
    with open(FileName) as f:
        reader = csv.reader(f, delimiter=Delimiter_Field)
        h = reader.next()
        n1, n2, n3 = int(h[0]), int(h[1]), int(h[2])
        # ABSOLUTELY NECESSARY FOR THE FILTER TO WORK:
        util.SetOutputWholeExtent(self, [0, n1 - 1, 0, n2 - 1, 0, n3 - 1])
        f.close()
Ejemplo n.º 13
0
def RequestInformation():
    from os.path import splitext
    sys.path.insert(0, r'EMC_SRC_PATH')
    import IrisEMC_Paraview_Lib as lib
    from paraview import util
    import IrisEMC_Paraview_Utils as utils
    import IrisEMC_Paraview_Param as param

    Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End = lib.get_area(
        Area, Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End)

    if len(Alternate_FileName.strip()) > 0:
        FileName = Alternate_FileName.strip()
        Label = ' '.join(['SLAB', lib.file_name(Alternate_FileName).strip()])
    else:
        FileName = lib.usgsSlabKeys[Slab]
        Label = ' '.join(['USGS Slab 1.0 -', lib.usgsSlabValues[Slab].strip()])

    FileName = FileName.strip()
    ext = None
    if FileName in list(param.usgsSlabDict.keys()):
        if utils.support_nc():
            ext = param.usgsSlabExtDict['ssl']
        else:
            ext = param.usgsSlabExtDict['geo']

    fileFound, address, source = lib.find_file(FileName,
                                               loc=r'EMC_SLABS_PATH',
                                               ext=ext)

    if not fileFound:
        raise Exception('model file "' + address + '" not found! Aborting.')

    this_filename, extension = splitext(address)

    if extension.lower() == '.grd':
        nx, ny, nz = lib.read_slab_file(address,
                                        (Latitude_Begin, Longitude_Begin),
                                        (Latitude_End, Longitude_End),
                                        inc=Sampling,
                                        extent=True)
    elif extension.lower() == '.csv':
        nx, ny, nz = lib.read_geocsv_model_2d(
            address, (Latitude_Begin, Longitude_Begin),
            (Latitude_End, Longitude_End),
            Sampling,
            0,
            extent=True)

    else:
        raise Exception('cannot recognize model file "' + address +
                        '"! Aborting.')

    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, nx, 0, ny, 0, nz])
Ejemplo n.º 14
0
def RequestInformation():
    sys.path.insert(0, "EMC_SRC_PATH")
    import IrisEMC_Paraview_Lib as lib
    from paraview import util
    fileFound,address,source = lib.findFile(FileName,loc='EMC_MODELS_PATH')
    if not fileFound:
        raise Exception('model file "'+address+'" not found! Aborting.')
    Latitude_Begin,Latitude_End,Longitude_Begin,Longitude_End = lib.getArea(Area,Latitude_Begin,Latitude_End,Longitude_Begin,Longitude_End)
    nx,ny,nz = lib.find2DnetCDFExtent(address,Latitude_Variable,Longitude_Variable,(Latitude_Begin,Longitude_Begin),(Latitude_End,Longitude_End),inc=Sampling)
    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0,nx, 0,ny, 0,nz+1])
Ejemplo n.º 15
0
def RequestInformation():
    sys.path.insert(0, "EMC_SRC_PATH")
    import IrisEMC_Paraview_Lib as lib
    from paraview import util
    fileFound, address, source = lib.findFile(lib.etopo5File,
                                              loc='EMC_MODELS_PATH')
    Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End = lib.getArea(
        Area, Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End)
    nx, ny, nz = lib.findTopoExtent(address, (Latitude_Begin, Longitude_Begin),
                                    (Latitude_End, Longitude_End), Sampling)
    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, nx - 1, 0, ny - 1, 0, nz - 1])
Ejemplo n.º 16
0
def RequestInformation():
    sys.path.insert(0, r'EMC_SRC_PATH')
    from os.path import splitext
    import IrisEMC_Paraview_Lib as lib
    from paraview import util
    import IrisEMC_Paraview_Utils as utils
    import IrisEMC_Paraview_Param as param

    if len(Alternate_FileName.strip()) > 0:
        file_name = Alternate_FileName.strip()
    else:
        file_name = lib.topoKeys[TopoFile]

    file_name = file_name.strip()
    ext = None
    if file_name in list(param.topoDict.keys()):
        if utils.support_nc():
            ext = param.topoExtDict['ssl']
        else:
            ext = param.topoExtDict['geo']

    fileFound, address, source = lib.find_file(file_name,
                                               loc=r'EMC_MODELS_PATH',
                                               ext=ext)
    Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End = lib.get_area(
        Area, Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End)

    this_filename, extension = splitext(address)
    if extension.lower() in ['.nc', '.grd']:
        nx, ny, nz = lib.read_netcdf_topo_file(
            address, (Latitude_Begin, Longitude_Begin),
            (Latitude_End, Longitude_End),
            Sampling,
            Roughness,
            lon_var=Longitude_Variable,
            lat_var=Latitude_Variable,
            elev_var=Elevation_Variable,
            extent=True)
    else:
        try:
            nx, ny, nz = lib.read_geocsv_model_2d(
                address, (Latitude_Begin, Longitude_Begin),
                (Latitude_End, Longitude_End),
                Sampling,
                Roughness,
                extent=True)
        except Exception:
            raise Exception('cannot recognize model file "' + address +
                            '"! Aborting.')

    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, nx, 0, ny, 0, nz])
Ejemplo n.º 17
0
def RequestInformation():
    from paraview import util
    sys.path.insert(0, "EMC_SRC_PATH")
    import IrisEMC_Paraview_Lib as lib

    if len(File_name.strip()) <= 0:
        fileFound = False
        address = ''
    else:
        fileFound, address, source = lib.find_file(File_name.strip(),
                                                   loc=r'EMC_VOLCANOES_PATH')

    if not fileFound:
        raise Exception(
            'volcano file "' + address +
            '" not found! Please provide the full path or UR for the file. Aborting.'
        )
    (params, lines) = lib.read_geocsv(address)
    num = len(lines)

    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, num - 1, 0, num - 1, 0, num - 1])
Ejemplo n.º 18
0
def RequestInformation():
    from paraview import util
    sys.path.insert(0, "EMC_SRC_PATH")
    import IrisEMC_Paraview_Lib as lib
    query = lib.volcanoLocationsQuery
    if len(Alternate_FileName) <= 0:
        volcanoFile = lib.query2fileName(query)
        query = '?'.join([lib.volcanoLocationsKeys[Data_Source], query])
        fileFound, address, source = lib.findFile(volcanoFile,
                                                  loc='EMC_VOLCANOES_PATH',
                                                  query=query)
    else:
        fileFound, address, source = lib.findFile(Alternate_FileName,
                                                  loc='EMC_VOLCANOES_PATH')

    if not fileFound:
        raise Exception(
            'volcano file "' + address +
            '" not found! Please provide the full path or UR for the file. Aborting.'
        )
    (params, lines) = lib.readGcsv(address)
    num = len(lines)
    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, num - 1, 0, num - 1, 0, num - 1])
Ejemplo n.º 19
0
def RequestInformation():
    sys.path.insert(0, "EMC_SRC_PATH")
    import IrisEMC_Paraview_Lib as lib
    from paraview import util

    Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End = lib.getArea(
        Area, Latitude_Begin, Latitude_End, Longitude_Begin, Longitude_End)

    if len(Alternate_FileName.strip()) > 0:
        FileName = Alternate_FileName
        Label = ' '.join(['SLAB', lib.fileName(Alternate_FileName).strip()])
    else:
        FileName = lib.usgsSlabKeys[Slab]
        Label = ' '.join(['USGS Slab 1.0 -', lib.usgsSlabValues[Slab].strip()])

    fileFound, address, source = lib.findFile(FileName, loc='EMC_SLABS_PATH')
    if not fileFound:
        raise Exception('model file "' + address + '" not found! Aborting.')

    nx, ny, nz = lib.getSlabExtent(address, (Latitude_Begin, Longitude_Begin),
                                   (Latitude_End, Longitude_End),
                                   inc=Sampling)
    # ABSOLUTELY NECESSARY FOR THE READER TO WORK:
    util.SetOutputWholeExtent(self, [0, nx - 1, 0, ny - 1, 0, nz - 1])
Ejemplo n.º 20
0
def RequestInformation():
    from paraview import util
    pdi = self.GetInput()
    util.SetOutputWholeExtent(
        self, [0, NumberOfSpaceBins, 0, NumberOfVeloBins, 0, 0])
def RequestInformation():
    from paraview import util
    # ABSOLUTELY NECESSARY FOR THE FILTER TO WORK:
    nx, ny, nz = extent[0], extent[1], extent[2]
    util.SetOutputWholeExtent(self, [0, nx - 1, 0, ny - 1, 0, nz - 1])