Error for fetching data from coops stations
saeed-moghimi-noaa opened this issue · comments
I am trying to use this script to download WL data for HSOFS (ATL) region:
from shapely.geometry import box
from datetime import datetime,timedelta
from stormevents.coops import coops_product_within_region
#hsofs bnd
bnd = -99.0,5,-52.8,46.3
#conos
#bnd=-180,4.4,-38,70
print(f'irma track bounds: {bnd}')
now_ = datetime.now()
now_3days = now_ - timedelta(3)
water_levels = coops_product_within_region(
product='water_level',
start_date = now_3days.isoformat(),
end_date = now_.isoformat(),
region=box(*bnd)
)
water_levels.to_netcdf('irma_water_levels.nc')
I got this error:
File ~/miniconda3/envs/adcircpy_env/lib/python3.10/site-packages/xarray/core/concat.py:516, in _dataset_concat(datasets, dim, data_vars, coords, compat, positions, fill_value, join, combine_attrs)
514 vars = ensure_common_dims([ds[k].variable for ds in datasets])
515 except KeyError:
--> 516 raise ValueError(f"{k!r} is not present in all datasets.")
517 combined = concat_vars(vars, dim, positions, combine_attrs=combine_attrs)
518 assert isinstance(combined, Variable)
ValueError: 'nws_id' is not present in all datasets.
this should be fixed now in aab8324
the issue was with appending empty sets of data that changed datetime64
to object
, and sometimes the s
value was blank for some reason so it was changing the dtype
from float64
to string