Opened 9 months ago

Closed 7 months ago

#2805 closed enhancement (fixed)

FIX - wcst_import should convert number to datetime string

Reported by: Bang Pham Huu Owned by: Bang Pham Huu
Priority: major Milestone: 10.3
Component: wcst_import Version: 10.3
Keywords: Cc: Dimitar Misev
Complexity: Medium

Description (last modified by Bang Pham Huu)

for example:

              "axes": {
                        "time": {
                            "min": "2015",
                            "irregular": true,
                            "dataBound": false,
                            "areasOfValidity": [
                                {
                                    "start": "2015",
                                    "end": "2025"
                                }
                            ]
                        },

here time is AnsiDate axis and "min": "2015", should be converted to "2015-01-01" implicitly instead of 2015 seconds and set the min value to time("1970-01-01T00:33:35 00:00").

Currently, one has to do that manually in the ingredients file with:

                       "time": {
                            "statements": "from datetime import datetime",                        
                            "min": "datetime.strptime('2015', '%Y').isoformat()",

Change History (2)

comment:1 by Bang Pham Huu, 9 months ago

Description: modified (diff)

comment:2 by Bang Pham Huu, 7 months ago

Resolution: fixed
Status: assignedclosed

wcst_import will try to convert the value of min/max of a temporal axis to ISO string format, so one does not have to convert manually the extracted text from file name to ISO datetime in the ingredients file like this:

"min": "datetime.strptime(regex_extract('${file:name}', '(.*)_(.*).tif', 1), '%Y%m%d').isoformat()",

instead one just needs to extract the value from file name like this:

"min": "regex_extract('${file:name}', '(.*)_(.*).tif', 1)",
Note: See TracTickets for help on using tickets.