-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFSTD_CheckInsideness.tcl
More file actions
55 lines (46 loc) · 1.31 KB
/
Copy pathFSTD_CheckInsideness.tcl
File metadata and controls
55 lines (46 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# the next line restarts using tclsh \
exec $SPI_PATH/tclsh "$0" "$@"
#============================================================================
# Environnement Canada
# Centre Meteorologique Canadien
# 2100 Trans-Canadienne
# Dorval, Quebec
#
# Projet : Exemple de scripts.
# Fichier : FSTD_CheckInsideness.tcl
# Creation : Mai 2010 - J.P. Gauthier - CMC/CMOE
# Description: Tester si des latlon sont a l'interieur d'une grille (LAM)
#
# Parametres :
# <File> : Fichier standard
#
# Retour:
#
# Remarques :
#
#============================================================================
package require TclData
#package require TclGeoEER
package require Logger
Log::Start [info script] 0.1
set fstd [lindex $argv 0]
set latlon [lindex $argv 1]
#----- Read in a field to get the grid
fstdfile open FSTDFILE read $fstd
fstdfield read FSTDFIELD FSTDFILE -1 "" -1 -1 -1 "P" ""
#----- Loop on the coodrinates
set f [open $latlon r]
while { ![eof $f] } {
#----- Get the coordinates
gets $f coords
set lat [lindex $coords 0]
set lon [lindex $coords 1]
#----- Get the corresponding gridpoint (outside= -1,-1)
set grid [fstdfield stats FSTDFIELD -coordpoint $lat $lon]
if { [lindex $grid 0]==-1 } {
Log::Print INFO "Coordinate outside ($lat,$lon)"
}
}
fstdfile close 1
Log::End