Skip to content

Commit

Permalink
FIX: Fix for more warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
zssherman committed Sep 26, 2023
1 parent 62b5a24 commit 3c74093
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 2 additions & 4 deletions act/io/armfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,8 @@ def read_netcdf(
# https://github.com/pydata/xarray/issues/3644
# To ensure the times are read in correctly need to set use_cftime=True.
# This will read in time as cftime object. But Xarray uses numpy datetime64
# natively. This will convert the cftime time values to numpy datetime64. cftime
# does not preserve the time past ms precision. We will use ms precision for
# the conversion.
desired_time_precision = 'datetime64[ms]'
# natively. This will convert the cftime time values to numpy datetime64.
desired_time_precision = 'datetime64[ns]'
for var_name in ['time', 'time_offset']:
try:
if 'time' in ds.dims and type(ds[var_name].values[0]).__module__.startswith('cftime.'):
Expand Down
6 changes: 4 additions & 2 deletions act/io/sodar.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import fsspec
import numpy as np
import pandas as pd
import xarray as xr

from act.io.noaapsl import filter_list

Expand Down Expand Up @@ -74,7 +75,7 @@ def read_mfas_sodar(filepath):
# tmp_columns is used to removed '#' column that causes
# columns to move over by one.
df = pd.read_table(filepath,
sep='\s+',
sep=r'\s+',
skiprows=skip_full_ind,
names=tmp_columns,
usecols=columns)
Expand Down Expand Up @@ -103,7 +104,8 @@ def read_mfas_sodar(filepath):

# Use unique time and height values to reindex data to be two dimensional.
ind = pd.MultiIndex.from_product((time_dim, height_dim), names=('time', 'height'))
ds = ds.assign(Dates=ind).unstack("Dates")
mindex_coords = xr.Coordinates.from_pandas_multiindex(ind, 'Dates')
ds = ds.assign_coords(mindex_coords).unstack("Dates")

# Add file metadata.
for key in file_dict.keys():
Expand Down

0 comments on commit 3c74093

Please sign in to comment.