Created
July 24, 2019 16:00
-
-
Save MiCurry/33632dbf29fca73ad9989454034ab91f to your computer and use it in GitHub Desktop.
MPAS Nearest Cell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import, division, print_function | |
import sys | |
import argparse | |
import numpy as np | |
from netCDF4 import Dataset | |
from mpas_py.mesh import MeshHandler | |
from mpas_py.soundings import read_soundings | |
""" Check to see if the soundings from a MPAS simulation are correct """ | |
parser = argparse.ArgumentParser(description=("Find the cell that is nearest to a given latitude" | |
" and longitude")) | |
parser.add_argument('mesh', | |
help='Mesh file', | |
type=str) | |
parser.add_argument('lat', | |
help='Latitude in degrees', | |
type=float) | |
parser.add_argument('lon', | |
help='Longitude in degrees', | |
type=float) | |
args = parser.parse_args() | |
meshFiles = args.mesh | |
lat = args.lat | |
lon = args.lon | |
mesh = MeshHandler(meshFiles) | |
mesh.load_grid_vars() | |
print(mesh.nearest_cell(lat, lon)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment