Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Michael Giansiracusa
netcdf2ascii_repo
Commits
d93b3aba
Commit
d93b3aba
authored
Jul 09, 2019
by
Michael Giansiracusa
Browse files
fixing issue where netCDF4.num2date throws ValueError when using time_offset variable
parent
0c073de1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
nc2csv.py
nc2csv.py
+8
-0
No files found.
nc2csv.py
View file @
d93b3aba
...
...
@@ -447,6 +447,14 @@ def process_one_file(variables: list, datastream: str, out_dir: str,
except
OverflowError
as
ofe
:
nc2csv_logger
.
warning
(
"{}: {} skipped."
.
format
(
ofe
,
file_name
))
return
None
except
TypeError
as
te
:
try
:
df
[
"date_time"
]
=
netCDF4
.
num2date
(
rootgrp
.
variables
[
'time'
][:],
rootgrp
.
variables
[
'time'
].
units
,
calendar
=
'standard'
)
except
Exception
as
e
:
nc2csv_logger
.
warning
(
"{}: {} skipped."
.
format
(
e
,
file_name
))
return
None
nc2csv_logger
.
debug
(
"created date_time column"
)
# Set the new column as the index so we can do date based slicing for dqr filtering later.
df
.
set_index
(
"date_time"
,
inplace
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment