Code Monkey home page Code Monkey logo

Comments (6)

picca avatar picca commented on August 15, 2024

the problem seems to be with the seconds

wait a minut the code contain this

def from_isotime(text, use_tz=False):
"""
@param text: string representing the time is iso format
"""
text = str(text)
base = text[:19]
if use_tz and len(text) == 25:
sgn = 1 if text[:19] == "+" else -1
tz = 60 * (60 * int(text[20:22]) + int(text[23:25])) * sgn
else:
tz = 0
return time.mktime(time.strptime(base, "%Y-%m-%dT%H:%M:%S")) + tz

but the len of the time data is ['2016-03-23T12:01: = 19
strange data format.

from fabio.

picca avatar picca commented on August 15, 2024

Here the information taken from hdfview
start_time (8760, 2)
String, length = 24, 1
Number of attributes = 1
description = Starting time of measurement

the content is

2016-03-23T12:01:28+0100

from fabio.

picca avatar picca commented on August 15, 2024

text before and after str(text)

['2016-03-23T12:01:28+0100']
['2016-03-23T12:01:28+0100']

This is an array of string

from fabio.

picca avatar picca commented on August 15, 2024

In [1]: from dateutil.parser import parse

In [2]: parse('2016-03-23T12:01:28+0100')
datetime.datetime(2016, 3, 23, 12, 1, 28, tzinfo=tzoffset(None, 3600))

maybe the right things to do is to use datetime on the string

from fabio.

picca avatar picca commented on August 15, 2024

When extracted with h5py, I get an array of string

In [8]: f['scan_27/start_time']
Out[8]: <HDF5 dataset "start_time": shape (1,), type "|S24">

but it seems that the value given to the from_isotime function is the string equivalent of the array

In [14]: str(f['scan_27/start_time'][:])
Out[14]: "['2016-03-23T12:01:28+0100']"

from fabio.

kif avatar kif commented on August 15, 2024

Hi Fred,
The problem comes from the "start_time" which is not a string but an array of strings.
"['2016-03-23T12:01:28+0100']" is not '2016-03-23T12:01:28+0100'

Dateutil looks nice but it is an additional dependency ...
I will fix the issue in "nexus" directly

from fabio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.