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/issues/2583#issuecomment-443298207,https://api.github.com/repos/pydata/xarray/issues/2583,443298207,MDEyOklzc3VlQ29tbWVudDQ0MzI5ODIwNw==,1197350,2018-11-30T18:38:29Z,2018-11-30T18:38:29Z,MEMBER,"A temporary workaround without updating xarray might be to just edit the attributes to remove the offending unsigned attribute before decoding cf? Sent from my iPhone > On Nov 30, 2018, at 1:35 PM, Deepak Cherian wrote: > > @jjspergel The single change in #2584 should fix your problem. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub, or mute the thread. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386268842 https://github.com/pydata/xarray/issues/2583#issuecomment-443297363,https://api.github.com/repos/pydata/xarray/issues/2583,443297363,MDEyOklzc3VlQ29tbWVudDQ0MzI5NzM2Mw==,2448579,2018-11-30T18:35:28Z,2018-11-30T18:35:28Z,MEMBER,@jjspergel The single change in #2584 should fix your problem.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386268842 https://github.com/pydata/xarray/issues/2583#issuecomment-443284388,https://api.github.com/repos/pydata/xarray/issues/2583,443284388,MDEyOklzc3VlQ29tbWVudDQ0MzI4NDM4OA==,2448579,2018-11-30T17:51:18Z,2018-11-30T17:51:18Z,MEMBER,"The problem is that `attrs['_Unsigned'] = 'false'` which always triggers `UnsignedIntegerCoder` https://github.com/pydata/xarray/blob/0d6056e8816e3d367a64f36c7f1a5c4e1ce4ed4e/xarray/coding/variables.py#L269 That line expects `unsigned` to be `bool` and ends up casting the signed integer to an unsigned integer and things go haywire. opendap is setting the `_Unsigned` attribute but it isn't present in the downloaded file. ``` ncdump -h http://www.ncei.noaa.gov/thredds/dodsC/avhrr-patmos-x-cloudprops-noaa-asc-fc/files/2003/patmosx_v05r03_NOAA-17_asc_d20030101_c20140314.nc byte cloud_fraction(time, latitude, longitude) ; cloud_fraction:_Unsigned = ""false"" ; cloud_fraction:standard_name = ""cloud_area_fraction"" ; cloud_fraction:long_name = ""cloud fraction computed over a 3x3 pixel array at the native resolution centered on this pixel"" ; cloud_fraction:coordinates = ""latitude longitude"" ; cloud_fraction:actual_range = 0.f, 1.f ; cloud_fraction:valid_range = -127s, 127s ; cloud_fraction:scale_factor = 0.003937008f ; cloud_fraction:add_offset = 0.5f ; cloud_fraction:_FillValue = -128b ; cloud_fraction:scaled = 1b ; cloud_fraction:_ChunkSizes = 1, 361, 361 ; ``` ``` ncdump -h patmosx_v05r03_NOAA-17_asc_d20030101_c20140314.nc byte cloud_fraction_uncertainty(time, latitude, longitude) ; cloud_fraction_uncertainty:long_name = ""cloud fraction uncertainty computed over a 3x3 array"" ; cloud_fraction_uncertainty:coordinates = ""latitude longitude"" ; cloud_fraction_uncertainty:actual_range = 0.f, 1.f ; cloud_fraction_uncertainty:valid_range = -127b, 127b ; cloud_fraction_uncertainty:scale_factor = 0.003937008f ; cloud_fraction_uncertainty:add_offset = 0.5f ; cloud_fraction_uncertainty:_FillValue = -128b ; cloud_fraction_uncertainty:scaled = 1b ; ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386268842 https://github.com/pydata/xarray/issues/2583#issuecomment-443281441,https://api.github.com/repos/pydata/xarray/issues/2583,443281441,MDEyOklzc3VlQ29tbWVudDQ0MzI4MTQ0MQ==,1197350,2018-11-30T17:41:12Z,2018-11-30T17:41:12Z,MEMBER,The CF decoding fails using opendap but not from the downloaded file. Pretty weird. ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386268842 https://github.com/pydata/xarray/issues/2583#issuecomment-443271861,https://api.github.com/repos/pydata/xarray/issues/2583,443271861,MDEyOklzc3VlQ29tbWVudDQ0MzI3MTg2MQ==,2448579,2018-11-30T17:09:23Z,2018-11-30T17:14:02Z,MEMBER,"I can reproduce that on `master`. Thanks for the good example. However, if I download the file, it seems to work OK. @jjspergel can you confirm that please? EDIT: ![image](https://user-images.githubusercontent.com/2448579/49303856-0b78dd00-f488-11e8-938e-67b19ca00c27.png) Also, note that the `scale_factor` and `add_offset` attributes aren't set in the first `ds.cloud_fraction` repr but is in `ds.cloud_fraction.encoding` ``` {'source': 'http://www.ncei.noaa.gov/thredds/dodsC/avhrr-patmos-x-cloudprops-noaa-asc-fc/files/2003/patmosx_v05r03_NOAA-17_asc_d20030101_c20140314.nc', 'original_shape': (1, 1800, 3600), 'dtype': dtype('int8'), '_Unsigned': 'false', '_FillValue': 128, 'scale_factor': 0.003937008, 'add_offset': 0.5, 'coordinates': 'latitude longitude'} ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386268842