html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/pull/5264#issuecomment-879523246,https://api.github.com/repos/pydata/xarray/issues/5264,879523246,MDEyOklzc3VlQ29tbWVudDg3OTUyMzI0Ng==,41898282,2021-07-14T01:52:10Z,2021-10-02T08:45:41Z,CONTRIBUTOR,"## Unit Test Results
6 files 6 suites 55m 20s [:stopwatch:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""duration of all tests"")
16 230 tests 14 495 [:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""passed tests"") 1 735 [:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""skipped / disabled tests"") 0 [:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""failed tests"")
90 576 runs 82 392 [:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""passed tests"") 8 184 [:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""skipped / disabled tests"") 0 [:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""failed tests"")
Results for commit fc8252e8.
:recycle: This comment has been updated with latest results.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-931822464,https://api.github.com/repos/pydata/xarray/issues/5264,931822464,IC_kwDOAMm_X843inuA,23625371,2021-10-01T01:27:24Z,2021-10-01T01:27:24Z,CONTRIBUTOR,@lewisjarednz fyi,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-931822417,https://api.github.com/repos/pydata/xarray/issues/5264,931822417,IC_kwDOAMm_X843intR,23625371,2021-10-01T01:27:15Z,2021-10-01T01:27:15Z,CONTRIBUTOR,@shoyer can I bother you again now that CI is passing please?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-882924370,https://api.github.com/repos/pydata/xarray/issues/5264,882924370,IC_kwDOAMm_X840oFtS,23625371,2021-07-19T23:19:01Z,2021-07-19T23:19:01Z,CONTRIBUTOR,Ignoring failing CI due to fsspec (see https://github.com/pydata/xarray/pull/5615#issuecomment-881679900),"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-879538970,https://api.github.com/repos/pydata/xarray/issues/5264,879538970,MDEyOklzc3VlQ29tbWVudDg3OTUzODk3MA==,23625371,2021-07-14T02:35:18Z,2021-07-14T02:35:18Z,CONTRIBUTOR,`xarray/tests/test_backends.py::test_open_fsspec` appears to fail because of the release of ffspec 2021.7.0 so this PR will probably have to wait until a fix for that is added (presumably elsewhere to keep the changes clear).,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-879533808,https://api.github.com/repos/pydata/xarray/issues/5264,879533808,MDEyOklzc3VlQ29tbWVudDg3OTUzMzgwOA==,23625371,2021-07-14T02:19:55Z,2021-07-14T02:20:27Z,CONTRIBUTOR,Something like 59ed7d5? (Obviously missing proper tests but just to get a sense of whether the idea is plausible),"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-879517988,https://api.github.com/repos/pydata/xarray/issues/5264,879517988,MDEyOklzc3VlQ29tbWVudDg3OTUxNzk4OA==,23625371,2021-07-14T01:41:38Z,2021-07-14T01:41:38Z,CONTRIBUTOR,I tried pushing a fix. It's unclear to me whether the change should be in how the dtypes are inferred (given that the inference code seems to do what it is meant to...) or whether `is_unicode_dtype` simply needs to be updated to know about `np.str_` (which is the fix I just tried).,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-833233473,https://api.github.com/repos/pydata/xarray/issues/5264,833233473,MDEyOklzc3VlQ29tbWVudDgzMzIzMzQ3Mw==,23625371,2021-05-06T05:21:19Z,2021-07-14T01:08:18Z,CONTRIBUTOR,"> What problem are you trying to solve here?
Somehow I ended up with `np.str_` in a pandas dataframe (how is unclear to me but this seems to be a valid string type), which then exploded when I converted to xarray and attempted to save as netCDF. Minimal example below.
```python
import numpy as np
import pandas as pd
# I don't know how the strings ended up being np.str_....
scenarios = [np.str_(v) for v in [""scenario_a"", ""scenario_b"", ""scenario_c""]]
years = range(2015, 2100 + 1)
tdf = pd.DataFrame(
data=np.random.random((len(scenarios), len(years))),
columns=years,
index=scenarios,
)
tdf.index.name = ""scenario""
tdf.columns.name = ""year""
tdf = tdf.stack()
tdf.name = ""tas""
txr = tdf.to_xarray()
# raises error shown below
txr.to_netcdf(""test.nc"")
# error
Traceback (most recent call last):
File ""scratch.py"", line 20, in
txr.to_netcdf(""test.nc"")
File "".../lib/python3.7/site-packages/xarray/core/dataarray.py"", line 2741, in to_netcdf
return dataset.to_netcdf(*args, **kwargs)
File "".../lib/python3.7/site-packages/xarray/core/dataset.py"", line 1699, in to_netcdf
invalid_netcdf=invalid_netcdf,
File "".../lib/python3.7/site-packages/xarray/backends/api.py"", line 1108, in to_netcdf
dataset, store, writer, encoding=encoding, unlimited_dims=unlimited_dims
File "".../lib/python3.7/site-packages/xarray/backends/api.py"", line 1154, in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
File "".../lib/python3.7/site-packages/xarray/backends/common.py"", line 256, in store
variables, check_encoding_set, writer, unlimited_dims=unlimited_dims
File "".../lib/python3.7/site-packages/xarray/backends/common.py"", line 294, in set_variables
name, v, check, unlimited_dims=unlimited_dims
File "".../lib/python3.7/site-packages/xarray/backends/netCDF4_.py"", line 464, in prepare_variable
variable, self.format, raise_on_invalid_encoding=check_encoding
File "".../lib/python3.7/site-packages/xarray/backends/netCDF4_.py"", line 131, in _get_datatype
datatype = _nc4_dtype(var)
File "".../lib/python3.7/site-packages/xarray/backends/netCDF4_.py"", line 154, in _nc4_dtype
raise ValueError(f""unsupported dtype for netCDF4 variable: {var.dtype}"")
ValueError: unsupported dtype for netCDF4 variable: object
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-848597492,https://api.github.com/repos/pydata/xarray/issues/5264,848597492,MDEyOklzc3VlQ29tbWVudDg0ODU5NzQ5Mg==,23625371,2021-05-26T08:58:23Z,2021-05-26T08:58:23Z,CONTRIBUTOR,"> I agree, this should totally work. It's not obvious to me how to best fix it, though.
I assume it's not as trivial as just changing e.g. https://github.com/pydata/xarray/blob/f9a535c130615fe81379d785dffcc6c814fc1126/xarray/coding/strings.py#L32 to also know about `np.str_`?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-848517059,https://api.github.com/repos/pydata/xarray/issues/5264,848517059,MDEyOklzc3VlQ29tbWVudDg0ODUxNzA1OQ==,23625371,2021-05-26T06:55:48Z,2021-05-26T06:55:48Z,CONTRIBUTOR,@shoyer any further thoughts on this now that the scope is clearer?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428
https://github.com/pydata/xarray/pull/5264#issuecomment-833182029,https://api.github.com/repos/pydata/xarray/issues/5264,833182029,MDEyOklzc3VlQ29tbWVudDgzMzE4MjAyOQ==,23625371,2021-05-06T02:37:57Z,2021-05-06T02:37:57Z,CONTRIBUTOR,So far I've just added a single test which fails. I don't think the test should fail although I'm not sure what the `np.str_` type actually is so maybe this isn't a bug? Help/advice greatly appreciated.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,877016428