[Thread Prev][Thread Next][Index]
Re: [ferret_users] reusing information from variable definitions
- To: ferret_users@xxxxxxxx
- Subject: Re: [ferret_users] reusing information from variable definitions
- From: Marco van Hulten <Marco.Hulten@xxxxxx>
- Date: Tue, 11 Feb 2020 11:30:50 +0100
- Arc-authentication-results: i=4; mx.google.com; dkim=pass header.i=@uib.no header.s=20160927 header.b=qK8Ny+Q+; arc=pass (i=2 dkim=pass dkdomain=uib.no); spf=softfail (google.com: domain of transitioning marco.hulten@xxxxxx does not designate 209.85.160.200 as permitted sender) smtp.mailfrom=marco.hulten@xxxxxx
- Arc-authentication-results: i=3; mx.google.com; dkim=pass header.i=@uib.no header.s=20160927 header.b=qK8Ny+Q+; arc=pass (i=2 dkim=pass dkdomain=uib.no); spf=softfail (google.com: domain of transitioning marco.hulten@xxxxxx does not designate 209.85.160.200 as permitted sender) smtp.mailfrom=marco.hulten@xxxxxx
- Arc-authentication-results: i=2; mx.google.com; dkim=pass header.i=@uib.no header.s=20160927 header.b=qK8Ny+Q+; arc=pass (i=1 spf=pass spfdomain=uib.no dkim=pass dkdomain=uib.no dmarc=pass fromdomain=uib.no); spf=softfail (google.com: domain of transitioning marco.hulten@xxxxxx does not designate 65.153.203.176 as permitted sender) smtp.mailfrom=Marco.Hulten@xxxxxx
- Arc-authentication-results: i=1; mx.google.com; dkim=pass header.i=@uib.no header.s=20160927 header.b=qK8Ny+Q+; spf=pass (google.com: domain of marco.hulten@xxxxxx designates 2001:700:200:30::141 as permitted sender) smtp.mailfrom=Marco.Hulten@xxxxxx; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uib.no
- 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 :message-id:content-transfer-encoding:mime-version:organization :references:in-reply-to:subject:to:from:date:sender:dkim-signature; bh=tbDnSmBedXM7hz8e1bNo7HKREl9yTe+cTBkz6N71Cuc=; b=dt3FPanKbk7tPGVa9T5gS3DG9qUF/C+jog75CGh3yB536yb96jPY2B2fR0kHtWjEDD oK+zpcQClYH9JmIJugLj4Z4I4HYJamn2owoBiKEhw5ANfkMJIYuT5dls3T445x+3MZz5 udes7rWUuJROTr/bVaw5gVeBlKEHQaZhIfx2ApP5n2WyF2yvI6z9VYMdNd2q21JLJ8kj SYwsVdOcmuzY89/nTYm7L6K8itX1u2rJr1ezLPUG5XwH0VhYDvwFTK3SXBPwjHW2iY/A t5w9m5oz0xx4HWpO7fOBtfgp7cPxkA/Adtx++XQwyY/vQdTCGkFi6dK94fXo6UoBt8jR 9sWQ==
- Arc-message-signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:content-transfer-encoding:mime-version:organization :references:in-reply-to:subject:to:from:date:dkim-signature; bh=tbDnSmBedXM7hz8e1bNo7HKREl9yTe+cTBkz6N71Cuc=; b=G2uljSh2+FX8U9AWHAGUZkrFd9t0QvxVdUfTnftyqT7uNvaid+M8ugIJc+mzExfWTU PxD51PlT7Qaq+ZB2G0bh2Bk0DEal8K7TwD79GXjbaLD4OKcTj+4YTKU5nL3jvLS8WiJ2 gC2ITEoUivl+fQoe1i2y4Fg91vIdOuF3wHCsN4McfSFSAfb8n2+PmcUJv8v62+VQrTKg cOHDUg15nQQjji1gIdgqcNDefJ7UXhyOKH28m4apKNzHjBNbmqqm6TM10XAotRN7a21j +kKLnOdcAVipkmNVH0GQdI7j3tZW4riQKbzpQLquzDSd4CXQTFnqmf4WJjz8XE5Yj8LE tCaw==
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:to:from:date:dkim-signature; bh=tbDnSmBedXM7hz8e1bNo7HKREl9yTe+cTBkz6N71Cuc=; b=HVCK8X/dFQgtMTV9ZJUPl0su8IA4dQm+ZeI/xQmG7fvygSI3zAcDh1qAXqLe2XLbeC 0BtTMVSPtZTS94vlgPbrQxePtL/+1fOzPY9rO+/sHyLArMeNi6JTCInBx4bhx+kQ2KLx OICElIbpG0nM3lURfXCFEXVzLdpUnYd6SJjzP6BhNhH/uz/DdZwvEruaLevSxTyCfUyC g76E0T9AyOw39T9M2pKnokvOdZMWRaZ1cZuH0soFnEyHZIHY7LJ3LWzboWMInLoPWX0B KAckb7fCz5tlTUkHnY0goYhdJSLDNfkpmzfbAWbZceOQL/M5eNaje5aEvzfHFBtFUK6h y9mw==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:to:from:date:dkim-signature; bh=tbDnSmBedXM7hz8e1bNo7HKREl9yTe+cTBkz6N71Cuc=; b=ZWYYGB/w+QCXVZzYxUGykUkcYELalX5mW/DzHpeZxW1FQQQrsEPXX8ulYgLIwHizYb SEqjrdUnyy9GG109qfdrO2BBh7m7oniK7eEo/gIT3JCrrZumR8l1s5T7aJjJiFMh/SlT SgybkI5ghu2fL4mXVvWK5nIXo/9cNamS7OMOA0B6kaqAPYVJuMNBv/vvSrc4ON4xH/Bo lK1+69EReW+ug4YBrYyEpKjakcW6N9HTeG2wqaM0XBefeuyHY5wiWDpxh9rQDz9aDi3p 4YUHQz9qvbSolG8mlBNDr1QEyj9a7ed8YjFPjLWsCIyW6ODBRrubvLm4UFYyLCDD6+Ds 4mFg==
- Arc-seal: i=4; a=rsa-sha256; t=1581417060; cv=pass; d=google.com; s=arc-20160816; b=bK+6U6FVkbfp+kqMWplBOSaWcIjS+d0ZPIdAvQmE2HdEChAdyUzTIYk1+7yKorcZsr E5swZnUDaSAMpORUqo2+69UEC1Wl1I1C2Ats1q0MQzXsWFMu4da5Ld3Ux9fGqq+TOYjP WgaZWhRfBlzK6omxjkIWOAV2gfo3sn2jdPVIo3k869IpSqPttFPSuViBU/2OJBAQ/9LF K9gInyk9tPcOS7pwiLyiJbA7Yt2WPSOVi7Sy9Tuuqwh/7N3DYdBzkpWaDo3rTtLM0mfd RxVc7HNPklVs62R4s5EMwlDBKhyxYtTh25A4jjg1GSy9j/LbupOEFBSXvwk+gPjC9SCh OUPA==
- Arc-seal: i=3; a=rsa-sha256; t=1581417059; cv=pass; d=google.com; s=arc-20160816; b=y3VJNIKPJhW2eOsdDas/L7p6i6HblevfByUKtL5epb+pz8yU6Nf3NQzPsGepwQfOCA tJuGTWbrYCZerHHs8nxDC0doXYn1qVzSFtwSYeKHvfo/tmSTn0aEJzrw22AIBB+YqnJO QIL7FmKJH7a+vAjLqhP5Z7ojr+kYy31K39sfJCtj2FaTBoZDN4EPCwz3f30Oqlihuwbx Ae/CFTL5DByDNVYF4yXOxyTw3C+5NxKhWA/uQHBThkLWmX1MKjyU5bQKXa5Ptx8kOEJj lFnB9NChcxs0EsP3Rthaz0f9/J0JVaSSzp9PoSXAYPARLBxu0t9RscydIkfL+/xVsTFN Cspg==
- Arc-seal: i=2; a=rsa-sha256; t=1581417055; cv=pass; d=google.com; s=arc-20160816; b=qW/lnTkkqPEQFIofVcOCsh1TH5sq25C7ZNtovhjmxGOzxInVDN4E7k7L9wklhK/f2v R3QdOx3rfFX1b65ylHniVz3liMLtNK0poDcPJQ5miaqJ8Zsnot3HhUbopEuIKqicYKNs ppKQd8Ma2Rv05SMTsGjVQZ+N+Mhvz8AVzn8KXLOXE1BP25dVkS492eBsy+F/FoQI6xMT S/swN+Vsc9yr8hwJHfRH+dYamCQrPWYzKsj2BL7RqagwtVat6HAkVyliN1hUGJ17iIC0 Wn4uTzmk7ImJECa5VXjMewPi1HCe06KrVL7nU/IUvebkd/41PkY38OBCYAN5u0mMq1hZ Xa9A==
- Arc-seal: i=1; a=rsa-sha256; t=1581417053; cv=none; d=google.com; s=arc-20160816; b=M5Q1SS+qQM2g9QtV98tSU8FexgBSm2JBu+0bwb1IxCFRSbTd2TW96mRZWaLK2TKPib TTvigGc3E7DP/+BjGYIxQU4KPl8AUjmrlY+ojQ3Dlx3a77dGZ2eIGgTpItoEZ9d/EQiS VwSXTHy4ZPijqnfmpd9NkWteMeP/K7btBd4BrLJe1IsEXMVSZxWCmdGMSI7tgWWBunHr XCh0RN0bQi9wMFSqHCH0NZ2JEeL8b2kfQl+PwvK9ycLolD7xwy2TGkxWtfkostuznb85 Z5KcvHOgcAbUmtpLu6Y2tQJCL+1KLa8wnT+aUQ9L382YjsTRxhzlmM2IyQ4PoQOK/kTH c/mA==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=noaa.gov; s=google; h=sender:date:from:to:subject:in-reply-to:references:organization :mime-version:content-transfer-encoding:message-id:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive; bh=tbDnSmBedXM7hz8e1bNo7HKREl9yTe+cTBkz6N71Cuc=; b=MaCrPGxSAOeHm/abszrd2itXmuDehHnQS25r1hriKPAeP4M+bz2lZq8o7vO4c28fqw VihnDQzXp5wA5y308KO25CWwU4qRDeEauNz4zVD0EWF1ArRZXHYvHy7JYKl3B92DYkgV X6oYOJt0wa9plQibms5PYV0G4JHbIu7EOMKEWVJQ7ojrfhV5yhw773lOY5sE55/ai4GB 8qkgvC6OadPAdt8s62IqgcIV6BH5sJM/nryJaVB8kchQTat2cSIifayS105Xq8I+eCJ2 m+kPVV7a/w0qSkYe7IRyavZoZb5vG/T2bdLgQmGe/Wz0O7by6M0HTfPxVld3KoyxC6Qv wP3Q==
- In-reply-to: <ME2PR01MB322055FFCCAA90D3A015AB8C9D180@ME2PR01MB3220.ausprd01.prod.outlook.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
- Organization: University of Bergen
- References: <20200127153619.0a19cf13@gfi063209.klientdrift.uib.no> <d00080bd-a43e-66d1-fd55-de6ccab4a0b0@noaa.gov> <20200210174651.41f8eccb@gfi063209.klientdrift.uib.no> <ME2PR01MB322055FFCCAA90D3A015AB8C9D180@ME2PR01MB3220.ausprd01.prod.outlook.com>
- Sender: owner-ferret_users@xxxxxxxx
Hello—
On 11 Feb 03:09 Fiedler, Russell (O&A, Hobart) wrote:
> It looks like the /LIKE qualifier could be what you're after.
>
> https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/DEFINE#_VPINDEXENTRY_1348
>
> All attributes are inherited (apart from missing_value, scaling and offset). You can override some if you want.
>
> e.g. (From the examples)
>
>
>
> yes? let/like=temperature/title="Surface Temperature" sst = temperature[z=0:5@MAX]
>
> so
>
> let/like=aa bb=aa+666
> let/like=bb/title="`bb,return=original_definition`" cc = bb
>
> which should be the same as
>
> let/like=aa/title="`bb,return=original_definition`" cc = bb
Yes, this would be the solution to the problem that I stated. The
/LIKE functionality is very useful. But I forgot to mention something
that complicates the issue. I will try to state the issue correctly
now.
Several datasets are loaded. It is known that AA is in one of the
datasets but not in which one. First, Tr is set as a function of AA:
let Tr = AA + 123.
If I were to do
let/like=AA Tr = AA + 123.
this would often result in failure as the current dataset may not be
containing AA. This 'Tr' is a general variable that I refer to in
later scripts, but AA's name is only known at the stage of this command.
The next thing I do is check in which dataset Tr is available, so
repeat/i=1:`ndsets` ( if `Tr,return=isReady` then ;\
let ndset = `i` ;\
exit/loop \
)
set data `ndset`
Note that I cannot determine 'ndsets' before defining Tr. Only after
ndsets is determined, I can set attributes, e.g. like
def attr Tr.units = "`AA.units`"
or, if not depending on current default dataset,
def symb Ndset = `ndset` ! avoid embedded ````
def attr Tr.units = "`AA.units[d=($Ndset)]`"
or by redefining
set data `ndset`
let/like=AA Tr = AA + 123.
or, again not depending on current dataset (apparently both in the
/LIKE and the expression I must say what the right dataset is, which is
somewhat inconsistent as let Tr=AA; set data `ndset` works fine, i.e.,
without specifying the dataset in the expression):
let/like=AA[d=`ndset`] Tr = AA[d=`ndset`] + 123.
But none of this would work, because I need to know the name of AA
(whether I set an attribute of Tr or redefine Tr with /LIKE).
I think the above is a MWE equivalent to what I try to accomplish in a
more complicated setting. For further rationale of my challenge, I
explain it below concretely (see http://complot.nongnu.org/ for full
context).
One may ask why I want to refer to AA only once (let Tr = AA + 123.).
This is not just an issue of inelegant code duplication. My main user
script is called with a tracer name argument, so in short this happens:
def symb Tr = ($1) ! user may have given "GbSi" as an argument
let GbSi = GSi ! variable expected in one of the datasets
let SbSi = BSi
let TPoC = POC
...
! Here we determine where ($Tr) is in (ndset).
! And then we do the proper initialisation:
set data `ndset`
let/like=GSi Tr = ($Tr)
! ^^^
! this we don't know
Am I overlooking something obvious?
—Marco
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement