You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
netcdf test {
dimensions:
Time = UNLIMITED ; // (1 currently)
DateStrLen = 19 ;
variables:
char Times(Time, DateStrLen) ;
data:
Times =
"2019-07-25_00:00:00" ;
}
Some explanation of what is going on:
Strings in numpy aren't the most friendly thing to work with, and the data types can be a little confusing. In your code, the "S1" data type is saying "this array has null terminated strings of length 1". That 1 in the "S1" is the string length. This resulted in you having an array of one character strings that was 19 elements long:
Since you know that your string length is going to be 19, you should tell numpy about this instead of xarray by either specifying the data type as "S19" or using the data type constructor (which I prefer): np.dtype(("S", 19))
MCVE Code Sample
Expected Output
Because I want to use the nc file as the input of WRF model,
I just need
Time
andDateStrLen
two dimensions.ncdump -h test.nc
:Although it's possible to set the exact
char_dim_name
toTime
like #2895,but I need the unlimited
Time
dimension as the first one.Problem Description
This is the actual output of
ncdump -h test.nc
:Output of
xr.show_versions()
xarray: 0.13.0
pandas: 0.25.1
numpy: 1.17.2
scipy: 1.3.1
netCDF4: 1.3.1
pydap: None
h5netcdf: None
h5py: 2.8.0
Nio: None
zarr: 2.3.2
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.5.0
distributed: 2.5.2
matplotlib: 3.1.1
cartopy: 0.17.0
seaborn: None
numbagg: None
setuptools: 41.2.0
pip: 19.2.3
conda: None
pytest: None
IPython: 7.8.0
sphinx: None
The text was updated successfully, but these errors were encountered: