delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/11/23/08:17:25

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:message-id:subject:from:to
:content-type; q=dns; s=default; b=JszF9By2063CbDMCme0RZrgEb0J02
lITbxH5YMA1g0ZMvhzRgUlhcejd4MDY4ldYf1+STsWsLhPpZ9hOfjTofCxHKJD/e
3Yayqh+C+FyUg1hCc/4qOEuMYxsUiopqmabBTAfgWgo0hkjVvb7j/gWPYgaTQ+07
OPGDq3wmJeUhVg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:message-id:subject:from:to
:content-type; s=default; bh=x5n6ak0HhL3N2+wgfcI8tr93Fl8=; b=jZN
CyfCse5DOs1GU/RMBQmATp34FeIWFp5y/z9N97tTnstVUYcYGLBl02G0IXwmtckY
IkZo8GNdpUIhs34JBvdUTRe8qNHvZFwOXSpv8VDSG7n8aB+O/lRkh1wruMHh3aWX
JJZWkm0HTb1FESv07KygUZkrmg0RLg1pk1p6Dm/A=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-lb0-f178.google.com
MIME-Version: 1.0
X-Received: by 10.112.54.229 with SMTP id m5mr10959620lbp.125.1448284621767; Mon, 23 Nov 2015 05:17:01 -0800 (PST)
Date: Mon, 23 Nov 2015 13:17:01 +0000
Message-ID: <CAE3taFC=tjki1FTfbjyt+KnEGsWmrj63FMeBjgRswRwRSKdAWQ@mail.gmail.com>
Subject: Awk not ouputting results via echo
From: Lester Anderson <arctica1963 AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

Hello,

Having sorted how to access a separate drive location, I have expanded
the script to include an awk section which processes new coordinate
limits which should pass to img2grd to extract the data grids.
However, the awk scripting does not seem to generate any data - is
there something I am missing? Modified from a published script

#!/bin/bash
ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img"
ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1"
lon_min=-12
lon_max=0
lat_min=28
lat_max=39
R_d=167
R_i=20

echo $lon_min $lon_max $lat_min $lat_max $R_d $R_i |
awk "{R_t=6370;
      pi=3.14159;
      lat_av=(($lat_max+$lat_min)/2)*(pi/180.);
      lon_av=(($lon_min+$lon_max)/2);
      d_lat_e=($R_d/R_t)*180./pi;
      d_lon_e=($R_d/(R_t*cos(lat_av)))*180./pi;
      d_lat_i=($R_i/R_t)*180./pi;
      d_lon_i=($R_i/(R_t*cos(lat_av)))*180./pi;
      lon_e_min=$lon_min-d_lon_e;
      lon_e_max=$lon_max+d_lon_e;
      lat_e_min=$lat_min-d_lat_e;
      lat_e_max=$lat_max+d_lat_e;
      lon_i_min=$lon_min-d_lon_i;
      lon_i_max=$lon_max+d_lon_i;
      lat_i_min=$lat_min-d_lat_i;
      lat_i_max=$lat_max+d_lat_i;
      print lon_e_min,lon_e_max,lat_e_min,lat_e_max,lon_i_min,lon_i_max,lat_i_min,lat_i_max,lat_av*180./pi,lon_av;
}" | read lon_e_min lon_e_max lat_e_min lat_e_max lon_i_min lon_i_max
lat_i_min lat_i_max lat_av lon_av
proj='m'$lon_av'/'$lat_av'/16'
echo $lon_e_min $lon_e_max $lat_e_min $lat_e_max $lon_i_min $lon_i_max
$lat_i_min $lat_i_max $lat_av $lon_av
#
img2grd "$ruta_elev"  -V -T1
-R$lon_e_min/$lon_e_max/$lat_e_min/$lat_e_max -S1 -Gelev.grd -I1m -D
img2grd "$ruta_grav" -T1 -V
-R$lon_e_min/$lon_e_max/$lat_e_min/$lat_e_max -S0.1 -GFA.grd -I1m -D
#

Any pointers on this, thanks

Lester

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019