[Thread Prev][Thread Next][Index]
Re: [ferret_users] Problems with netcdf output and zaxreplace
- To: Giorgio Graffino <g.graffino@xxxxxx>
- Subject: Re: [ferret_users] Problems with netcdf output and zaxreplace
- From: "Ansley C. Manke" <ansley.b.manke@xxxxxxxx>
- Date: Wed, 20 May 2020 09:52:03 -0700
- Arc-authentication-results: i=2; mx.google.com; dkim=pass header.i=@noaa.gov header.s=google header.b="hO9/cgK8"; spf=pass (google.com: domain of ansley.b.manke@xxxxxxxx designates 209.85.220.41 as permitted sender) smtp.mailfrom=ansley.b.manke@xxxxxxxx; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=noaa.gov
- Arc-authentication-results: i=1; mx.google.com; dkim=pass header.i=@noaa.gov header.s=google header.b="hO9/cgK8"; spf=pass (google.com: domain of ansley.b.manke@xxxxxxxx designates 209.85.220.41 as permitted sender) smtp.mailfrom=ansley.b.manke@xxxxxxxx; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=noaa.gov
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-archive:list-help:list-post:list-id:mailing-list:precedence :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=R0oMJ5mFmTP7atszvp4l+WOZlBFMS2bcOVlCrGk7+Y4=; b=IwOD9toF1bZy78lO+2FZRnixXpR1X9wynVlP6VRJO4yJMtNXumhl6hthmvINLcOHj8 On7/wv5rBjZJMlLU4V37co30D68xQ13cI0ycO9uAcwyQEugMF8g0Uw4FPjZwIDVUUsVz xJsL7pUA6RqQ5WxJTnvRQPpdOfs9q4TTSR1+74YzIUNZ2nWlKQAAyavNuWNMU5KhgOLH geVf07+SPE0ffAT4i+m/Ci4rbXOQvW0bIkWug8Qs3EhIkWxZTeGBlln1ch0svH5sBWu0 cqp85pVN6d6zBuNGP2KdmDYE5N/9a3V5pRRxgZoryzwHrPO/uGhOJV2Q31PTpimur3Xn oQLg==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=R0oMJ5mFmTP7atszvp4l+WOZlBFMS2bcOVlCrGk7+Y4=; b=JTV5dO2BHgxl/5C/9UAChyuHLuureDCvNHBE7er+PVdFvsxDipL3bmkC/hP9+859il lZagXIX12CaU5Q7IU2RF4fp6sO9I6OnZrqCLBf0Yn7OmNy/QN8SQS4bEo9rGi+RB4oIc JvO7u+c63neIunqXWTwnMPmf1ZXS27Lc0TpgNMpOTm1HErGWC+dDHdOcyD067clSMcmR aVhkh0b7rAeTdgBggf+Gj9PCr14q9kMKY3JKepPTsiPPkDq4mMhpx/JEKg6YHV87PSEk 4eMcOmYu6nkz5ixFtx5vMKjWXLJSdUZKJIiCDFBzHZotqVDH33p+c+D2elYhgkAhG5GT L29w==
- Arc-seal: i=2; a=rsa-sha256; t=1589993528; cv=pass; d=google.com; s=arc-20160816; b=kE+QeILJpn4jDsYBk/eFefXdvFjtk1JPLqjLZNsRlzPwSnDd6Cjz8YcnacVhzHK9mh tlBByyqVTrOmrF/LOKnySnkMuEj2vISJ4R+/d59mRfdqwWOxp73OkUo5wwGaakimG9Cm qKXxY9R2snXgWV5h7fbp2/4GPy6CfWO3L1KZIQ65GCtHRLh3e1SgCYiH2slT3qT0oswN 90XcWMOVkYdrwnrWk9Rj1NlhCgA02pogmMnhmL1jcna9JO3VWrjFfxQszgu5NRb8JS41 RCRJ/hGO3bRqrKbbFuHUEwAI3Ps0KR7kaULxNFcKy8TtnBQYpNGRgY1yCB5UKd+A/6Gy vLkw==
- Arc-seal: i=1; a=rsa-sha256; t=1589993527; cv=none; d=google.com; s=arc-20160816; b=szXZX7qwLnGTVLeMkSMHx9pnJwilc0r0edmrsu3rz4IYLHr/FZxUncpIm5tIDN6EQg 6G/FRgVJ7YxTIAYCjr4GRQsorTvoVFO/4DPoWrivOZ5Y3T0XQMBpgsmbKj2Tkmp03mP7 2KR2RxuEIMdA6RN+EfwHZzFmjxdiGC7OoMI2vSwQv2g/93CExkTV5gKZ7O343Fw6jMgC I33p7Fnj6ll3fxL7IPo7aalTacr8J3ENxg316nX/idP931V8ICaxTpQ5POu8GdSBeB/B mLvQbbkhkx+ugVOeK2oBvViiKGqSQoTcvI7QnimI/lng1Vy8L/iPmhBO+RCDVTP1iM/R pOuw==
- Cc: ferret_users@xxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=noaa.gov; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive; bh=R0oMJ5mFmTP7atszvp4l+WOZlBFMS2bcOVlCrGk7+Y4=; b=CaEmnzsQi+BUPdS0MkyOVDc95aVlFiLSXLyQsJ59whSTfDHCuoGl9S8XCZbkIWZ1Iv TSTMMMinK34qBnCYh8ho8bfOd0EEfl+ESi9mZhFPFEtEoAUXCZXMO68kbe3mBCwV53g9 FCHPzfZFQI94AGMPWX6xLGOyqRjQO/PPTvmuUm5n3rNmasxnYUy0npbZdSuHA/udGG+q t1byWLOzY50Fv9Be44Inu5Cgo1r4zLBcWLaxkYtrDh89ici2m3lxlZ3BNpXLDVvVWP62 BvwhHN4O+XVBFu/NWntnKNR8ICnWltd/3dsFQXxyTcaZellRG6QCRrWCul4aqcKZ89Fc Yh2Q==
- In-reply-to: <17228e57792.g.graffino@tim.it>
- 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: <17228e57792.g.graffino@tim.it>
- Sender: owner-ferret_users@xxxxxxxx
- User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0
Hi,
You could pass into the script the number of models
> ferret -script scriptname.jnl 7
The script then does a repeat loop that would start like this.
let nmodel = ($1)
repeat/range=1:($1)/name=r (\
use /home/data/model`r`.nc;\
...
There are details on the grave-accent
evaluation that give you some flexibility. For instance if
the models are named model01.nc, model02.nc, ... use the
"precision" specifier to ask for the value to be replaced with
zero-filled numbers, here 2-digits.
let nmodel = ($1)
repeat/range=1:`nmodel`/name=r (\
use /home/data/model`r,p=z2`.nc;
Or, you could use a unix foreach loop and write your script to
operate on just one model if that makes sense for what you are
doing. Here I've made a script myscript.jnl with:
! myscript.jnl
echo ($1)
This is csh, other shells will have other syntax.
/home/users/ansley> set flist = 'model_run_7.nc
ocean_model_run5.nc http://address/climate.nc'
/home/users/ansley> foreach fname ($flist)
foreach? ferret -script myscript.jnl $fname
foreach? end
model_run_7.nc
ocean_model_run5.nc
http://address/data/climate.nc
On 5/18/2020 10:47 AM, Giorgio Graffino
wrote:
Hi Ashley,
thanks for your suggestion.
I preferred to implement the other method
because it involved a single Ferret call, but I haven't thought
about passing all variables in that way. You are suggesting
something like
ferret -script scriptname.jnl model1 model2
model3
which would be great to have, but I should
find a way to loop across all models from inside the jnl script.
Now my jnl script includes
define symbol model = ($01)
to read the argument, because I'm parsing only
one argument at a time. How can I loop over all models from
inside the jnl script?
Cheers,
Giorgio
----Messaggio originale----
Da: ansley.b.manke@xxxxxxxx
Data: 12-mag-2020 19.55
A: <ferret_users@xxxxxxxx>
Ogg: Re: [ferret_users] Problems with netcdf output and
zaxreplace
Hi Giorgio,
Another method for sending Ferret/PyFerret a set of
commands is to use the -script option on startup.
> pyferret -script my_script.jnl [arguments]
This is generally more flexible than piping commands. The
startup option -batch for Ferret or -nodisplay for PyFerret
are also useful when you don't want to have graphics windows
display. Note that -script must appear last among command
line switches so that the script arguments will be parsed
correctly.
Unix
command-line switches
On 5/9/2020 3:19 AM, Giorgio
Graffino wrote:
Hi Ryo,
thanks to your "quote" suggestion I could successfully
run my bash script.
Cheers,
Giorgio
----Messaggio originale----
Da: furue@xxxxxxxxxx
Data: 28-apr-2020 14.28
A: "Giorgio Graffino" <g.graffino@xxxxxx>
Cc: "Ferret" <ferret_users@xxxxxxxx>
Ogg: Re: [ferret_users] Problems with netcdf output and
zaxreplace
Hi Giorgio,
!->
REPEAT: I=1
**ERROR: command syntax: II = ???
define symbol ii
Compare this line with the one in the original
shell script:
ferret << STOP
. . .
define symbol ii `i`
. . .
STOP
Where did `i` go?
In the shell script as well as in the ferret
script, the backquote construct is evaluated. In
the above shell script, the shell tries to run a
command named "i". It fails and is replaced with
an empty string. I suppose you saw this error
message on your screen
. . . i: command not
found
To prevent the shell from interpreting the
backquote construct, you "quote" the here-document
by
ferret <<'STOP'
. . .
STOP
Ryo
--------------------
To see what's going on, run this kind of test
shell script
echo date
echo `date`
echo "abc `date` def"
echo 'abc `date` def'
cat <<EOF
date
`date`
EOF
cat <<'EOF'
date
`date`
EOF
--
Ansley Manke
Science Data Integration Group
NOAA Pacific Marine Environmental Laboratory
7600 Sand Point Way NE
Seattle WA 98115
I am currently teleworking and am available Tue-Wed-Thu.
--
Ansley Manke
Science Data Integration Group
NOAA Pacific Marine Environmental Laboratory
7600 Sand Point Way NE
Seattle WA 98115
I am currently teleworking and am available Tue-Wed-Thu.
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement