[Thread Prev][Thread Next][Index]
Re: [ferret_users] add (degenerate) axis to variable
- To: ferret_users@xxxxxxxx
- Subject: Re: [ferret_users] add (degenerate) axis to variable
- From: Ansley Manke <a.c.manke@xxxxxxxxx>
- Date: Thu, 1 Apr 2021 12:02:22 -0700
- Arc-authentication-results: i=4; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lVA23u3c; arc=pass (i=2 dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of a.c.manke@xxxxxxxxx designates 209.85.222.198 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=20161025 header.b=lVA23u3c; arc=pass (i=2 dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of a.c.manke@xxxxxxxxx designates 209.85.222.198 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=20161025 header.b=lVA23u3c; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=softfail (google.com: domain of transitioning a.c.manke@xxxxxxxxx does not designate 65.153.203.172 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=20161025 header.b=lVA23u3c; 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 :message-id:content-language:in-reply-to:mime-version:user-agent :date:from:references:to:subject:sender:dkim-signature; bh=AalmXAV/xR02R6I3d1lBifH9RyG/HdEQNLZSSH5MBJQ=; b=Y3YIFsNxbHBU8Sbez59YQhRXbtacvSUz24xCSCBZk0UslLMEkJtMTYYKpCA7ThGlBG mmfFz7o7iAUcho1CHslM7yD7hQVA9iYyKBUR9aBlbwKZBukLxx3xkMQ+QOIZDPwQGEkx S99dQq+trSsL0m7ItJ12C7dK+s6Qwb8/h1g9JTjaisww92k3KMsjs+tvbG3SfXXUDzt2 knP/ZCZXE3qdkxSoitFze2i+mYiZzw8Idyxh8AnZgz2PFkxFpLkiWip7aC9sA7Joew6E bB/5eVVWSXxnjSCT3LuAT5nHUDubzrsqI5coIXRnjAIIzQkCjeVGnZnj41Uq710dDkNY mSEA==
- Arc-message-signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:content-language:in-reply-to:mime-version:user-agent :date:from:references:to:subject:dkim-signature; bh=AalmXAV/xR02R6I3d1lBifH9RyG/HdEQNLZSSH5MBJQ=; b=cvWjkEGDHzGRk6JqwncZ3cZ2k7kjH+d3Nl5Z/NFwDuj8mXpDUlWGW/MUY4e94vyNmp 5UbNIfh57fkTA4kc7GFZsCvqK6oodWGNPKOLV/8QQ8N+YryHHdvW3lBpHPPegAZUqVPO x2MW9Bn5c2WYQEHSeydztfiAtLeFg9XYtO+3syk82U0uKhh3fglehsYSJ2cWv8nlpxGB ocoptzORT/p3dAu2yqYe7Dgrd1+Ye2SgcPw9hJ0LcBa1bQLeqrS8XPWV1W5jEkcqqGxu Q0/Kpdg/PqY4lWUVuOpXtnnZdKBvtT0Cz9aL50GeWJ3P7AOB2jm9DhnUrV2sKvefUBHq FG8w==
- Arc-message-signature: i=2; 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:to:subject:dkim-signature; bh=AalmXAV/xR02R6I3d1lBifH9RyG/HdEQNLZSSH5MBJQ=; b=bfbwudwpIoGQpUgtfb1CcSK0Z7hstsnARlL18hak4qWBBkMZmJENwdgTDKB98dkj6g cSEWZ7w6VyVqlmIQjXjDgHwsJslnyZ8onblf+r2b5K1W0JUvV8dHraJ2p3lg7a+CDJ8J 7CUOO4FHyg6vHNyqIPk2YDVbXXK4tKl7l1iVdLss80nE6fjgE0SDJqBDDmSxtl7zreOX zNjs/2LANaP6bRfe7Fe+YhGWaadCLq+NP738jDj8sxSOdYONeg81fud7Pek33BSqjaaE fWApyDhId03XX5MFpHwOAL7J6+gQp7sxOAtPLUcq19CD7Rd5N4OpttuGyD6akg1JRRcb Mpvw==
- 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:to:subject:dkim-signature; bh=AalmXAV/xR02R6I3d1lBifH9RyG/HdEQNLZSSH5MBJQ=; b=lZXj7c5fJAWqqW7VpBlLIewxFDqluAnulwDEY/QnzpJb0H98tmJwKhTjchwZBBYPvO RlSC1M1pIg+YZRBp+DHLSNCIi1HWU1c5TfcwremUiO6kGMdNEP4j3NgapCu1EKzmSDFC PzFdFv6A9EDX+EgxFWjKESEE1Thko1pQjFW8UXHEUG7Q0GyLUhO7zo1LOPLw1sy0krZn BvrTDbe5wd/51DEFFGeIcjS3f+UBZ+HDrhtHL+F6sTXefVH0IqqMVkgtMEMZkrDmkDL8 CPx+31tE/QcllRiN+NIiO04TSgBtHYHOU/hgHfV48oTNxX7oXvmEZ/iZyPf77pDz025I 5MrA==
- Arc-seal: i=4; a=rsa-sha256; t=1617303750; cv=pass; d=google.com; s=arc-20160816; b=I5hcjgkrQlt7+3VFZvXGWrElB4hcYfGGERxg5LSw4iGJA2Gu/lDUu2XWQ20fgwdDXS /FTyilHC2woVJhoNJ+aVxYBLecxL189DG9BceMzxqjajKWJ5JEtQ4CtQ/juI3v/BGxLx fW/qV8tdQNQzuq+Aj+8Z9aGzqOuxag8u+HBs5ZdipQgXssE5pnv1ARyzLhWhfVTggryE tc2VbjNqAKlwjKIo8uay1heAgnw/IW0DINj4OFtXzDANABPDPihvITKYq19JddifkI7i S7eFsuIguJowZcQ4FTjRTteMAQMh2SMuxOS9sLRAnoQWMJ2FDslqyyl5p+Hm129TVkf2 3pyA==
- Arc-seal: i=3; a=rsa-sha256; t=1617303749; cv=pass; d=google.com; s=arc-20160816; b=d+1MRyMofINFdSRusTaV/tNX7vILj4AmDVRATinn4Y7wXylGweWAf9AmYvDsFH/3mX GUUw1JxBqTNfMiUKhUMZe1MSoTZpnnmuOf6ibz4MP+yz7xg6VPkGKg2oJ1ty5P7GcmpZ nxoVmoUPuOVlVJDEXgTYKX45TPgcy0dUprFSkpYgGuHALqZXy24XIgAYd6NCTIxGgQJb bCuHN2o/3TwGdr5E2f1+tETItHwrUCsj+fQtLTsQ3+2gN3Sw3W2GLx2chkThw2tU/lC3 V4UqtrEi4sMVzRzNH8ry/WyVFSOHhd2em11TKXBQ7gMjbXZy5v8AhSigBH7QgzPd5B8v giCg==
- Arc-seal: i=2; a=rsa-sha256; t=1617303747; cv=pass; d=google.com; s=arc-20160816; b=QTYIOAIbq2eiqtkxlcbncs2oOArkYvqmZUzTckI8gtOM91iNpjAihefusZudHU+dkn 4lvTDRLeKJmD7jwkXtN8Th1GQrsPmyE1JNx+YWwIFHTuL9dX9IrnJI6sqvgLVOQxPIl0 aUZ0T9gx2ocvLKCXfJ/cHXLB7bmNyZIEuVcCyUrndxUP5dzhykBitsOHqxVT3Sye/qEv 5mbrcl7Mb6qf2P9MxQm86+0nqDa/qaVcDsl5iKHE/jsKKmpoHZF3ucxyl4m/tLZxy2QT HfjUhF+2RtJTVr5hDlNc39GjUhlNvOk5n5k6i7XMN6tiLgTwVXdSCs30CxkQy2oRHsoC bT+g==
- Arc-seal: i=1; a=rsa-sha256; t=1617303746; cv=none; d=google.com; s=arc-20160816; b=CpEtTrUrcnrh4VopVOZRy9fSdtU+IBoCTgMiRxnBUdPZCcjDs4934uMZpvh0uVdj29 nojJ0ZMOFt/1lsYJZj8EZvM+5IQejHKW9vin/Hqh55UungFVIiphbur3jBT3LMNSgdr6 fzPQzs4n44Iw4Tinr5DRVzviNJmG9eeCphc0mudAz4tQ+3F0nvSW18e+zt8HZkwJOMtg nz2MnhhZ5XewvWdXxba0g2ZxNFzWD5NATCwrHieeUipRNJbHMOAiV83A4efoWJB/L0HI GHaMXF6BvNYaHJq7PqUeFR3JI4yL6qV8rEP2t18JYGfdWsLlTGZntUeaHglJDbphZ/01 AqRQ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=noaa.gov; s=google; h=sender:subject:to:references:from:date:user-agent:mime-version :in-reply-to:content-language:message-id:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive; bh=AalmXAV/xR02R6I3d1lBifH9RyG/HdEQNLZSSH5MBJQ=; b=bdx6cH4Pr+orhQijFlkEUwoR9Oo6A5DkBllJrzVRH2pvTYxFt7UoGa89A0V9yW+aJa Ugy3+vohGJYrReyiHKoSpauT9TgW2Y3a/dgNH8fCpE6kB+/8VMG5+MEux0uzAOS9olE4 R0dWD9UYZ/4xPO8a1BZ2UBErSelSqIw27y/y18nhHkUdcz0xvWX468ZPkjB0Op1P3GSp MuF43mQ274mIwcitHD3qcjHAD14OAAeWWyDh2wS+3z7kv4JPnluknqOsbSrctOb6Dtyi 6fPOXbwhuxrIgvN16I8tXzCqysoYtb93QXW2z9rLbZAt7PXQ7PYQN/aLGyAneo+2qqrP vL3w==
- In-reply-to: <8c00cf58-55b1-c2b9-1fd2-0b90fb732217@noaa.gov>
- 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: <e69bb74e-173e-00eb-f4d5-01f11ec08cdd@noaa.gov> <CALC=m4q5jQPE6zfTKf_1bnQ6oEJbP88-Oew1qMmeYTBDP=_djw@mail.gmail.com> <4161f294-b638-f9f0-35c7-3a98c42aef90@noaa.gov> <6575dfdb-9e11-9501-f189-ee7982be6900@gmail.com> <57fa3b15-bd0f-265b-87c9-37390da4db19@noaa.gov> <8c00cf58-55b1-c2b9-1fd2-0b90fb732217@noaa.gov>
- Sender: owner-ferret_users@xxxxxxxx
- User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0
Hi Andy,
NCO is often a really good answer, and of course you could do all
of this with NCO.
But since we're on the topic, maybe I can finish it off from the
Ferret point of view. (By the way, look for "timestamp" in the
Ferret documentation.)
If your time axis is defined as a calendar time axis with
recognized time units and timesteps defined terms of dates, it
should automatically be marked as the record axis when saved to a
netCDF file.
! open dataset containing SST, and define the time axis.
use my_xy_data.nc
define axis/t=1-jan-2020:1-jan-2020:1/units=days tax
! A variable with value 0 on the time axis.
let timestamp = 0*t[gt=tax]
! Rename the file variable, so we can keep the original name in
the new file
set variable/name=sst_in sst
! Define the variable with the original name, units, and title,
and
! adding the time axis to the grid. tax is the record axis.
let/like=sst_in sst = sst_in + timestamp
save/clobber/file=new_xyt_data.nc sst
A pretty common thing is for someone to create a set of files
files containing for example a single month per file, but the
variables in the files have no time axis. The time information
might be in an attribute somewhere or be indicated only by the
filename. The framework above can be used to define a a time axis
for the whole time range and then apply the appropriate timestep
to each file.
There is much discussion of monthly time axes in the
documentation, regularly-spaced axes, true monthly axes, and so
on. See the "DEFINE" section of the manual. Here I'll show how
this goes using a regularly spaced axis.
! Define a monthly axis and a
timestamp variable, 0 at all the timesteps.
define axis/t=1-jan-2020:31-jul-2022:1/t0=1-jan-2000/units=month/edges
tmonth
let timestamp = 0*t[gt=tmonth]
! Open the files one by one, add the timestep variable, and then
write out the
! correct single timestep for this dataset to a new file.
use data_01_2020.nc
set variable/name=sst_in sst
let/like=sst_in sst = sst_in + timestamp
save/clobber/file=data_01_2020_fixed.nc
sst[L=1]
cancel data/all
use data_02_2020.nc
set variable/name=sst_in sst
let/like=sst_in sst = sst_in + timestamp
save/clobber/file=data_02_2020_fixed.nc
sst[L=2]
cancel data/all
...
Now, you can use a time aggregation to work with the set of files
as a virtual timeseries dataset, see
https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/DEFINE#_define_data_agg
! new session
let file_list = SPAWN ("ls -1 data_*fixed.nc")
tseries sst_months = file_list
show data ! sst in dataset sst_months will have a time
axis
show grid sst ! the time axis is tmonth
On 4/1/2021 10:12 AM, Andy Jacobson
wrote:
Just FYI,
NCO makes this extremely easy:
ncks -O --mk_rec_dmn time ${infile} ${outfile}
-Andy
On 3/31/21 7:17 PM, Andy Jacobson wrote:
That works! Thanks, Ansley. Now...is there
some magic that I can use to designate my new time axis as the
record (unlimited) dimension?
Best,
Andy
On 3/31/21 6:59 PM, Ansley Manke wrote:
Hi Andy,
You can add a variable on the desired time axis with a value
of 0 everywhere. This uses the idea of "conformability
<https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/XPRESSIONS#_VPINDEXENTRY_300>"
- the principals that govern how variables created from on
unlike grids can be combined.
so,
yes? let/like=temp temp_new = temp + 0*t[gt=t1]
Ansley
On 3/31/2021 10:35 AM, Andy Jacobson wrote:
Yes, I tried [...gt=t1@asn] syntax.
Ferret didn't complain, but it didn't output that time axis
either.
Thanks,
Andy
On 3/31/21 10:44 AM, Satyesh Ghetiya wrote:
Have you tried giving that time axis
to variable by GT ? -->
let your variable is Temp and time axis name is T1, then
-->
let Temp_new=Temp[gt=T1]
^ This should work.
On Wed, Mar 31, 2021 at 10:04 PM Andy Jacobson
<andy.jacobson@xxxxxxxx
<mailto:andy.jacobson@xxxxxxxx>> wrote:
Howdy,
I have a 2-d variable (lat, lon) that I read from a
well-formatted netCDF file. This represents one month out
of a time series of many such files. I'd like to add a
time axis to this variable. I've defined my single-point
time axis, but I can't figure out how to convince ferret
to add this time axis to my variable. Normally I'd do this
in NCO but I'd like to stay in ferret this time. Is there
some reshape trickery involved?
Thanks,
Andy
-- Andy Jacobson
andy.jacobson@xxxxxxxx
<mailto:andy.jacobson@xxxxxxxx>
NOAA Global Monitoring Laboratory
325 Broadway R/GMD1
Boulder, Colorado 80305
303/497-4916
G Satyesh,
India
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement