[Thread Prev][Thread Next][Index]

Re: [ferret_users] how to map date strings from a csv file onto a ferret time axis



Hi Al,

In general, you can read date/ time information from a text file with  "set data/form=delimited" 

https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/SET#_VPINDEXENTRY_1612
https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/data-set-basics/ASCII-DATA#Chapter2-delimited_files

It looks like what's in your file corresponds to the "datime" format, but you would need to edit the file to replace the T with a space, and remove the Z.  Also, if the file has quotation marks around the dates, remove those.

It should go something like this:

  yes? file/form=delim/var="ftime"/type="datime" myfile.csv

  ! Look at the time data and its units. Dates are translated into "days since 1900,
  ! and time is added as a fraction of the day

   list/i=1:10/precision=8 ftime 
   define axis/t/t0=1=jan=1900/units=days my_time_axis = ftime



On 1/31/2022 1:44 PM, Albert Hermann - NOAA Affiliate wrote:
Hi,
Does anyone know how to easily map dates like the ones shown below (contained as a variable in a csv file) onto a time axis in ferret? The file contains one date string and temperature value (plus other variables) per line. So far I have not found any ferret function that can interpret these strings - does one exist? Thanks.
-Al Hermann


yes? list/i=1:10 time
             VARIABLE : TIME
             FILENAME : 2021_SpringDeployed_BS_BioPUFFS_POPS0001_bottomdata.csv
             SUBSET   : 10 points (X)
 1    /  1:"2021-05-13T00:10:00Z"
 2    /  2:"2021-05-13T01:10:00Z"
 3    /  3:"2021-05-13T02:10:00Z"
 4    /  4:"2021-05-13T03:10:00Z"
 5    /  5:"2021-05-13T04:10:00Z"
 6    /  6:"2021-05-13T05:10:00Z"
 7    /  7:"2021-05-13T06:10:00Z"
 8    /  8:"2021-05-13T07:10:00Z"
 9    /  9:"2021-05-13T08:10:00Z"
 10   / 10:"2021-05-13T09:10:00Z"

--
albert.j.hermann@xxxxxxxx
Pacific Marine Environmental Laboratory
7600 Sand Point Way NE
Seattle WA 98115
206-526-6495

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement