Beispiel #1
0
def _generate_mesh(geojson_filename, action, dataset):
    msh_filename = os.path.splitext(geojson_filename)[0] + '.msh'
    if action in ('update', 'download') or not os.path.exists(msh_filename):
        geo_filename = os.path.splitext(geojson_filename)[0] + '.geo'
        mesh.main(geojson_filename, geo_filename)
        subprocess.call(['gmsh', '-2', '-format', 'msh2', geo_filename])

    return msh_filename
Beispiel #2
0
def get_images():
    clear_folder(datasetPath + "images")
    clear_folder(datasetPath + "projections")
    try:
        uploaded_files = request.files.getlist("file[]")
        for idx, file in enumerate(uploaded_files):
            file.save(dst=datasetPath + "images/" + file.filename + ".jpg")

        camera.main(datasetPath)
        pmvs.main(datasetPath)
        mesh.main("expansion_pointcloud.ply")
        print('DONE')
    except:
        print(exc_info())
        return jsonify({"message": "fail"})
    return jsonify({"message": "done"})
Beispiel #3
0
def main():
    mirror = False
    cam = cv2.VideoCapture(0)
    while True:
        ret_val, img = cam.read()
        if mirror:
            img = cv2.flip(img, 1)
        img = mesh.main("img", sys.argv[1], sys.argv[2])
        cv2.imshow('web', img)
        if cv2.waitKey(1) == 27:
            break  # esc to quit
    cv2.destroyAllWindows()
Beispiel #4
0
def runn(mode, character, crop_mode):
    if mode == 'vert':
        out_vert.main(character)

    if mode == 'repose':
        repose.main(character)

    if mode == 'mesh':
        mesh.main(character)

    if mode == 'crop':
        extractor.main(character, crop_mode)

    if mode == 'convert':
        convert.main(character)

    if mode == 'comp':
        replacer.main(character)

    if mode == 'swap':
        fswap.main(character)

    if mode == 'train':
        train.main(character)
Beispiel #5
0
def vol_to_grids(vol_ffn, grid_config, vol_dbz_offset):
    #refl cappi index
    #5 = 2.5km
    cappi_index = 5
    #read radar
    radar = pyart.aux_io.read_odim_h5(vol_ffn, file_field_names=True)
    try:
        #check if DBZH_CLEAN is present
        refl_field = radar.fields['DBZH_CLEAN']['data']
    except:
        #run clutter filtering if DBZH_CLEAN is missing
        refl_field, _ = clutter.main(radar, [], 'DBZH')
    #run range filtering
    R, A = np.meshgrid(radar.range['data']/1000, radar.azimuth['data'])
    ma_refl_field = np.ma.masked_where(np.logical_or(R<10, R>120), refl_field.copy())
    radar.add_field_like('DBZH', 'MA_DBZH_CLEAN', ma_refl_field, replace_existing=True)

    #temp data <-- get from ACCESS-R archive
    temp_data = mesh.temperature_profile_access(radar)

    #grid
    grid = pyart.map.grid_from_radars(
                    radar,
                    grid_shape = grid_config['GRID_SHAPE'],
                    grid_limits = grid_config['GRID_LIMITS'],
                    roi_func = 'constant',
                    constant_roi = grid_config['GRID_ROI'],
                    weighting_function = 'Barnes2',
                    fields = ['MA_DBZH_CLEAN'])
    #extract data and apply refl offset
    refl_grid = grid.fields['MA_DBZH_CLEAN']['data'] - vol_dbz_offset
    alt_vec = grid.z['data']
    #calculate refl field
    REFL = refl_grid[cappi_index,:,:]
    REFL_meta = {'units': 'dBZ', 'long_name': 'Horizontal Reflectivity Factor',
                'standard_name': 'reflectivity', 'comments': 'calibrated reflectivity'}
    #convert to mesh
    MESH, MESH_meta = mesh.main(refl_grid, alt_vec, temp_data)
    
#     fig = plt.figure(figsize=[10,10])
#     plt.imshow(REFL)
    
    #return 2D mesh grid
    return MESH, MESH_meta, REFL, REFL_meta