I have a netcdf file. The "Times" in this netcdf is 2010-06-19_01:00:01. I tried to change it through NCL with script below. However, it shows the type dismatch error. Kindly ask for any suggestion that can modify this. Thank you.
Here's the attribute of "Times":
(0) Type of 'Times': character
(0) Dimensions of 'Times': 1
(1) Dimensions of 'Times': 19
(0) Values of 'Times':
Variable: times
Type: character
Total Size: 19 bytes
19 values
Number of Dimensions: 2
Dimensions and sizes: [Time | 1] x [DateStrLen | 19]
Coordinates:
Number Of Attributes: 0
(0,0) 2
(0,1) 0
(0,2) 1
(0,3) 0
(0,4) -
(0,5) 0
(0,6) 6
(0,7) -
(0,8) 1
(0,9) 9
(0,10) _
(0,11) 0
(0,12) 1
(0,13) :
(0,14) 0
(0,15) 0
(0,16) :
(0,17) 0
(0,18) 1
Here's my script that want to change the Times from 01:00:01 to 01:00:00:
begin
f = addfile("cstm_d01_2010-06-19_01_00_00.nc", "r+")
times = f->Times
times(0,18) = "0"
f->Times = times
delete(f)
end
The error is fatal:Assignment type mismatch, right hand side can't be coerced to type of left hand side fatal:["Execute.c":8637]:Execute: Error occurred at or near line 10 in file test2.ncl
Thank you in advance.
Use script to define times(0,18) first