[ncl-talk] set_date_time
Kunal Bali
kunal.bali9 at gmail.com
Thu Oct 5 12:40:09 MDT 2017
Dear NCL users,
I have one question regarding date-time setting from filename. This
question is not actually related to NCL, sorry in advance.
I have 4 .nc files named given below. The time is not created in these
files during conversion from hdf to netcdf in NCL.
MAIACTAOT.h00v02.*2000364**07**15*.nc --> 2000=year, 364=day, 07=hr,
15=min
MAIACTAOT.h00v02.20003650620.nc
MAIACTAOT.h00v02.20003660525.nc
MAIACTAOT.h00v02.20003660700.nc
So, I did try to create the date-time with shell scripting (given below)
but it is creating wrong date as the files are of December month, but it is
generating January month date also. I don't know why.
*2000-01-01 05:25:00*
*2000-01-01 07:00:00*
2000-12-30 07:15:00
2000-12-31 06:20:00
the shell script, which I am using
#######################################
for n in MAIACTAOT.h00v02.20*.nc;do
ls $n > text
export xx=`cut -c18-28 text`
export YYYY=`cut -c18-21 text`
export JJJ=`cut -c22-24 text`
export HH=`cut -c25-26 text`
export MM=`cut -c27-28 text`
mm=`date -d "$JJJ days $YYYY-01-01" +"%m"`
dd=`date -d "$JJJ days $YYYY-01-01" +"%d"`
mydate=${YYYY}-${mm}-${dd},${HH}:${MM}:00
echo $mydate
echo "cdo settaxis,$mydate $n re$n"
cdo settaxis,$mydate $n re$n
done
cdo mergetime reMAI*.nc final.nc
exit
#################################
Any suggestion regarding this issue would be very helpful.
Thank You
Kunal Bali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171006/90ff96e7/attachment.html>
More information about the ncl-talk
mailing list