Menu

FindNearestCpoint Log in to Edit

Bjarne Büchmann

Find nearest C-point

Introduction

GETM curvilinear bathymetries include information on both corner points and central (C-) points. The C-points of the bathymetry coinside in the horizontal with the pressurepoints (T-points) of GETM.
For pre- and post-processing it is often advantageous to find the point in the bathymetry, which is closest to a particular position. For curvilinear coordinates, this is not a straight-forward process. The present python script (find_nearest_cpoint.py).

This can be convenient for instance to find locations for the scatter utility, or processing to nesting.

Usage/example

bjb@swell$ python find_nearest_cpoint.py --latval=52.20 --lonval=1.66 --latname=latc --lonname=lonc topo.nc
Looking for target point as (lon,lat)
Reading input nc-file topo.nc
Creating geoide to compute distances
Making great circle computations (inverse geod lookups)
Nearest point found at index (0-based/C-style):
(i,j) = (186,117)
(lat,lon) = (52.199957,1.660139)
Note that the distance to point is 11 m
ncks should confirm with e.g.
ncks -H -d xic,117 -d etac,186 -v lonc,latc topo.nc
All done OK


Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.