[Thread Prev][Thread Next][Index]
Re: [ferret_users] Checking the argument in Go script
- To: ferret_users@xxxxxxxx
- Subject: Re: [ferret_users] Checking the argument in Go script
- From: Ansley Manke <a.c.manke@xxxxxxxxx>
- Date: Wed, 21 Dec 2022 11:01:40 -0800
- Arc-authentication-results: i=4; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PdT3Gi0l; arc=pass (i=2 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of a.c.manke@xxxxxxxxx designates 209.85.222.197 as permitted sender) smtp.mailfrom=a.c.manke@xxxxxxxxx
- Arc-authentication-results: i=3; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PdT3Gi0l; arc=pass (i=2 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of a.c.manke@xxxxxxxxx designates 209.85.222.197 as permitted sender) smtp.mailfrom=a.c.manke@xxxxxxxxx
- Arc-authentication-results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PdT3Gi0l; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of a.c.manke@xxxxxxxxx designates 209.85.220.41 as permitted sender) smtp.mailfrom=a.c.manke@xxxxxxxxx
- Arc-authentication-results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PdT3Gi0l; spf=pass (google.com: domain of a.c.manke@xxxxxxxxx designates 209.85.220.41 as permitted sender) smtp.mailfrom=a.c.manke@xxxxxxxxx; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
- Arc-message-signature: i=4; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-archive:list-help:list-post:list-id:mailing-list:precedence :in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:sender:dkim-signature; bh=hSaNcgHwlsUvNzSGDdwSh5xoM/O2XPhmyKfY/RA62Uo=; b=WC1/GWq8lP+HEH0i9kXBi58MrqVIw/GMbXxtldPVAGzpR0ALGM2SVhhLxt0p0x5GvJ A4ZRp7X5zHQWR5HGUGg+Ns5REvdekvBIFy81fyXIrBx1c+UnxjVs/+dwhOgL3Ge9/zV2 Hy5P2bde49U+2Iv7OyyPojPS/c7lTHqjHCK8KXafJl9MevYc20B8b5N2E/Hx0AfJn56L w62P4InfkjjsVWMm9aMTv46LBZSKLAQuqBf9P0tfZGyVIl9BSIVqR3rnq34zJiNggScH p1sXpBjmErtfDLvrhaGoUTJwAvoxfQkp9McXGopoD2JeqMlluXXayNX1Q3KwSnewZ5Bw 2DOw==
- Arc-message-signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=hSaNcgHwlsUvNzSGDdwSh5xoM/O2XPhmyKfY/RA62Uo=; b=oGhfSB708r/eXwz9VdTWnOqunubfdiyVBDYGCK1ZUrIFuXpwF1lcD4C+ZgtwT3GSaU /TJWxhl9GYlJLwpszd3S2qCh1U8xAbDIbiWs5w2HRmzgrqdxgEWQaIXlvO0vjOGNEQvo qcrbeGXo3PTM9lBJUl8z5ZCafjRkoi7mU7dKZ/8WCtdhyNwxylApF+Ak9vtefQDrTvWQ /Bfhbqdv/TVeSLaM/fqVeEUVaWYimYAyiRxgY+XC9t9PM31/1ArsPUzW/I25+rs1v0bo 1wP6oWP79+geFloFav8G+a0bbkFVmGbxdQpeYawGWcWLPsN42FtoDxjTmXz846pWIssm T91Q==
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=hSaNcgHwlsUvNzSGDdwSh5xoM/O2XPhmyKfY/RA62Uo=; b=z/0rcSwHyMoNbtwcZFud+Pp6/0KXUk3ysT0jD0LakTASndzGJoV/A618wir2WTpSMi BNb1s6BD/BwQ4k/hryuwg++QAjuqJPUqcgRAeYf9n5GRg4FboCTzQdg3oYYFJ5s4+ogv Ev9bXF5bbei312mpmiwqu8gSkwNMsJOKxzrATE5LtsC5CC3G8IywkSnBFoK4/cOEnuv0 IwrcxiTf/lppSLo+JlDKY5i4bgfgah6ig81UCyCY7WVm4GvYGo4jnynLHR9QJmlcJLcN ek1See2WBbEG93k0Xy72oQSDDw0GiQQtGssF+RGuZBkEVc43ALztFzTaCVOs8cBwic5i cZbw==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=hSaNcgHwlsUvNzSGDdwSh5xoM/O2XPhmyKfY/RA62Uo=; b=Z4GiEsExjk3Fb287bHavQ7CJsxtWSUxB9LTCbwEQ7iK1v41lJKflZLUz5CZbh/30RK 88JIFXREho4v9nV77Wh/bxkoV54GETlwdS6fnzfJr+nL2CmdZMMJSsdGORvQDeV7j5b9 g8j62GpNQ1+QfsYewOehokFq0AdARTnlwliQJJbKzLrBE7qUcZJ5Hx31HlrSuVLBYqr3 onAqvl9S9zccd1SGJQNYhswza2KcZPngsC3rLKPmZ/qspNmxMTDhg1Y/ZhGeAKSLeWvA /Nh0CenwBRT4/UbXmQnT9zXzstQf76SAU0sQG7bj0e9Ki/RiJr+pSw9100yjgFTb9GdN 9ymw==
- Arc-seal: i=4; a=rsa-sha256; t=1671649309; cv=pass; d=google.com; s=arc-20160816; b=fhJA+UNndV8odvjQeyQZX3yFi5coKdoA/NkX5QBNJS8CHmme2rORkknNerTLIP1PoN cMa07JMQICc1gy+04llo/Pcx/9xKnxERyNz/2Sax6FcA65D7lyVHeUvTnh1+hZdnc0wL pgiSk/gmLXVvvyoCn8zk35uweeY6Vq6CzVUapbBSRnWzDFkxSEU1fPsLt1O2SPYc2Px5 BeAhKD3x0yUeF71ja4VZdbBHUeeNwbOjDl5Vm+NFxK/twePL0QDxLoyod43yio5FPW24 hNtSJq8MkptisLcnBQ0UB2vUqXExFEl1hb4MOkQ07T9uzhefBuaL1xjrHeWRRidY15ac zltg==
- Arc-seal: i=3; a=rsa-sha256; t=1671649307; cv=pass; d=google.com; s=arc-20160816; b=ow0UxS0HTBKYq3XAACraO2ddYPF9UEeeRBJcGXAmOezLjnBg7r07aorPdUa976Uapf CoFo7WWh7dZ0+ENq56RAZopaC23mbHA/kOvX2A/l/AiwVfxWVZMhW9H2h+qVOmw7Xe8u kEhyuD7qh/Q2TB1215BUetE3F2aC1FCLubM6gkR7JECpe+Piw1iCQVS1P0YorlP4OrKp 1u7ID7/OBKDUvc6PshUi4ye4KAM6oBXSwgHD430WP7z4YYQuQp17DWNRy0BgkfLwWDRl 1ERsjsFVPMVyQVPtytD2//xmc3FiI7vbG1bovRVafj6DxlkVn4YV3RpVwAs1K+Wd2q6h vhXw==
- Arc-seal: i=2; a=rsa-sha256; t=1671649304; cv=pass; d=google.com; s=arc-20160816; b=XqsCIX2lU2HaB3zgHSxTJaNz0u5nZvRPz+5I3eU+qAAxItcJw7UVr4X4jQE2PuNhM8 WNtooBBYDUZtXogC+UR1E6L1Ujv9w1Og4o0XGfyGbgwkzpMWagecMdbbmg6xxAetY/rF nrhBz2Eeu+uiA99Ql4ABRMileaF5/RjOBG4c9uzDj5WKjnEKs6UDwyMXe4GCFihbef1M ACLhY4SoWbydAXCh5hbtTc32os3y2qU0c6y8YVXrnKuj38ine2fpIUk9lekoLzlK7F43 7p9ZH7Mq27K8H6kL/7UMQdhuS1LF0ryPwn6g2M2K4fTV8R4OxPRsI/WqNMjV4vDMXnBy loFA==
- Arc-seal: i=1; a=rsa-sha256; t=1671649303; cv=none; d=google.com; s=arc-20160816; b=jmbKE1MchnKf6pZeE0mjSd52WqSLNouy1gog4iAlLXNKk2SKsjRc+bnORKg0eFVQ4g friePn7h5jnBIxSJV0GMS2A0f5paaUtq1IBt5mvsepuCoItuTnm52KEKHBsGapWOsZ9T XU8J/+RjBOsDgGkemDc8unCp6AsHV78SX3L5bMvbMBcXoheDFCW04I4quYbWlWQkyAK2 mEXPxn/71V/XeM3TLDIXY4IDqqdoFugAXknJrNg6rM4RT3l4z/qgXI2VBi1i9YH7rLFR +VNsvVlVcSE/CSqZ+XcoSmgN5s2jlQHLcgI1ZRjRgadN3UB5bKPIK14QxvW2+CKYDSF5 5+lw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=noaa.gov; s=google; h=list-archive:list-help:list-post:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:in-reply-to :from:content-language:references:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=hSaNcgHwlsUvNzSGDdwSh5xoM/O2XPhmyKfY/RA62Uo=; b=LwpURAUSRU2WRlmlxygdKDxbRq+cJt9FIbiRfQlm81gQWyu9pvQ+8zCEV1rNnFg2xQ /kbnH7iQiSNw4dxat9wdjtL1yZoTFqOaIiQbts1fuzFig4YCMokk3h/ZFL6FsbUmyfbT 2o9DPEpkqx6Fotxd7EXlWiYolmWQS4s1bkdcjNNiARBW8SLWqDAnGFnBXaSjrxjgbLbh qR0EWLP7gmZdI4HULdklMYTqXMiVzcOens9ISXGgubJ4VL+6SiHnq22/P0q/f0I/cABJ ObOfcufZAyM6RmdZVQJq+iQF6CnWby7rA3roXAfBsRTsO4vWxO31ewkNrOCU0P2+FIRp erXQ==
- In-reply-to: <CAK0Qe2OH2R6=F-wzw+B5gDt=+-fUeXDrhZvDPg76F+RgMZRYtw@mail.gmail.com>
- List-archive: <https://groups.google.com/a/noaa.gov/group/ferret_users/>
- List-help: <https://support.google.com/a/noaa.gov/bin/topic.py?topic=25838>, <mailto:ferret_users+help@noaa.gov>
- List-id: <ferret_users.noaa.gov>
- List-post: <https://groups.google.com/a/noaa.gov/group/ferret_users/post>, <mailto:ferret_users@noaa.gov>
- Mailing-list: list ferret_users@xxxxxxxx; contact ferret_users+owners@xxxxxxxx
- References: <024f01d914d4$b24949b0$16dbdd10$@internode.on.net> <CAEwQpa+4cd4RN6GOxJFdXxLsRV2nJgyhv=G77W1HMwY4bse5+Q@mail.gmail.com> <CAK0Qe2OH2R6=F-wzw+B5gDt=+-fUeXDrhZvDPg76F+RgMZRYtw@mail.gmail.com>
- Sender: owner-ferret_users@xxxxxxxx
- User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1
Here's a good discussion about arguments to jnl scripts:
https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/introduction/GO-FILES#_VPINDEXENTRY_126,
especially the section "Arguments to GO tools". Arguments are
Ferret symbols, so symbol parsing and substitution syntax works
here.
One thing I often want to do is to check whether the argument has
been given, and if so, does it have a valid value. Says I'm
expecting a value for the year in argument 1.
This says, assign the value of the argument to a variable. If
they didn't send in a value, then assign 0 to my variable. Then
the script can check to see if that's a valid value. (The
parentheses are optional.)
let year = ($1%0%)
if `year gt 2020` then ...
Or do something like this:
if `($1%0%) LT 2015 or ($1%0%) GT 2023`
THEN
say argument 1 is not in the valid range of years: $1
exit/script
endif
The QUERY command lets you do this kind of checking, and issue an
error message if needed, without the IF statements, but it doesn't
do anything you couldn't do with an IF-THEN-ENDIF sequence. See
it in some of the scripts included with PyFerret:
yes? go/help land.jnl
On 12/21/2022 3:28 AM, William Kessler
- NOAA Federal wrote:
I've never heard of QUERY either, but there are some
situations when using the $n arguments fail. For
instance using them to write filenames when two of these
in sequence ($1$2), or with an underscore before it.
I just define regular symbols for them:
def sym dol1 `$1`
def sym dol2 `$2`
These can be used freely.
You can also have a script define a default value
that the argument will take if the command that calls
the script doesn't include a value:
def sym symbol_name $1"default_value"
Billy
Dear Mark,
I have a
very simple question. I want to check the
value of arguments in GO scripts, e.g. $1 $2
and so on when a program is running.
I suppose you want to print out the values on your
screen. If so,
\cancel mode verify
say 1st arg = ($1)
say 2nd arg = ($2)
set mode/last verify
(Switching off and on of the verify mode is
optional.)
If I
include the command QUERY $1 in a GO script
the value is returned to the terminal but the
program stops.
Because I've never heard of QUERY, I'll leave this
issue for more knowledgeable people.
Ryo
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement