;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************
begin
ts = (/ "3-31-11 23:00" \
, "3-31-11 23:05" \
, "3-31-11 23:10" \
, "3-31-11 23:15" \
, "3-31-11 23:20" \
, "3-31-11 23:25" \
, "3-31-11 23:30" \
, "3-31-11 23:35" \
, "3-31-11 23:40" \
, "3-31-11 23:45" \
, "3-31-11 23:50" /)
delim = "- :"
tsfc = str_fields_count(ts, delim)
print(" number of fields: tsfc="+tsfc(0))
mm = str_get_field(ts, 1, delim) ; array of strings
dd = str_get_field(ts, 2, delim)
yy = str_get_field(ts, 3, delim)
hh = str_get_field(ts, 4, delim)
mn = str_get_field(ts, 5, delim)
if(mn .le. 30) then
mn =00
else
mn=00
hh=hh+1
else if(hh .eq. 24) then
hh=00
dd=dd+1
else if(dd .eq. 32) then
dd =1
mm=mm+1
end if
if (hh .le. 8)then
hh=hh-8
else if(hh .le. 8 .and. dd .not. 1)then
hh=hh+24-8
dd=dd-1
else if(hh .le. 8 .and. dd .eq. 1)then
hh=hh+24-8
dd=31
mm=mm-1
end if
print(mm+" "+dd+" "+yy+" "+hh+" "+mn)
end
I do not know how to use if or else if. FirstI just want to make the hh integer ;second i want to make the hh cut 8 hours so i get the global time! need your help!thank you !
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Mon Oct 24 2011 - 09:29:35 MDT