unable to write date in the correct format

From: ugo merlini <ugomerlini_at_nyahnyahspammersnyahnyah>
Date: Sat Sep 24 2011 - 08:34:04 MDT

Hi,

i'm trinyng to write a txt file date from gfs dataset. I print the date on video it appears in the right format (2011092400), but when I put in the txt file it is write in a diferent format (2.01109e+09)

a txt line should be

2011092400 15.05 sereno

instead of

2.01109e+09 15.05 sereno

why?

regards

Ugo

;----------------------------------------------------------------------

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/calendar_decode2.ncl"

begin

;******************
; read gfs data *
;******************
 
  systemdate1=systemfunc("date +%Y%m%d00")
  url = "http://nomad1.ncep.noaa.gov:9090/dods/gfs_master/gfs" + systemfunc("date +%Y%m%d") + "/"
  systemdate = systemfunc("date +%H")
 
  if ((systemdate.ge.06).and.(systemdate.lt.12)) then
    filename = url + "gfs_master_00z"
  end if
  
  if ((systemdate.ge.12).and.(systemdate.lt.18)) then
    filename = url + "gfs_master_06z"
  end if
  
  if ((systemdate.ge.18).and.(systemdate.lt.00)) then
     filename = url + "gfs_master_00z"
  end if
  
  if ((systemdate.ge.00).and.(systemdate.lt.06)) then
     filename = url + "gfs_master_00z"
  end if
  
  exists = isfilepresent(filename)
  if(.not.exists) then
    print("OPeNDAP isfilepresent test unsuccessful.")
    print("Either file doesn't exist, or NCL does not have OPeNDAP capabilities on this system")
  else
    print("OPeNDAP isfilepresent test successful.")
    gfs = addfile(filename,"r")
    vars = getfilevarnames(gfs)
  end if
 

  

;---data for 2 metres temperature plot
  
  ;TEMP2M = gfs->tmp2m(:,45,9) ; temperature
  NTIMES = dimsizes(gfs->time) ; number of times in the file
  TIME=(gfs->time(:))
  TIME@units ="days since 1-1-1 00:00:0.0"

  
  ;TEMP2M = TEMP2M - 273.15
  ;TEMP2M@units = "(C)"
  t=new((/NTIMES,3/), string)
  s=new((/1,NTIMES/), string)
   do it1 = 0,NTIMES-1
        print(calendar_decode2(gfs->time(it1), 3))
       ;if ((systemdate.ge.06).and.(systemdate.lt.12)) then
         t(it1,0)= calendar_decode2(TIME(it1), 3)

        ;end if
      
        
     
      t(it1,1) = (gfs->tmp2m(it1,{45},{9})) - 273.15
      if(.not.ismissing(gfs->otcdchcl(it1,{45},{9}))) then
        
      if ((gfs->otcdchcl(it1,{45},{9})).le.25) then
             t(it1,2) = "sereno"
      end if
      if (((gfs->otcdchcl(it1,{45},{9})).gt.25).and.((gfs->otcdchcl(it1,{45},{9}).le.50))) then
             t(it1,2) = "poco_nuvoloso"
      end if
      if (((gfs->otcdchcl(it1,{45},{9})).gt.50).and.((gfs->otcdchcl(it1,{45},{9}).le.75))) then
             t(it1,2) = "nuvoloso"
      end if
      if (((gfs->otcdchcl(it1,{45},{9})).gt.75)) then
             t(it1,2) = "coperto"
      end if
      else
         t(it1,2) = "valore_non_pervenuto"
      end if
      s(0,it1) = t(it1,0)+" "+t(it1,1)+" "+t(it1,2)
      
   end do
  
    s=(/ s(0,ispan(0,NTIMES-1,1)) /)
    asciiwrite("/mnt/internetserver1/www/meteo/prova.txt", s)
end

                                               

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Sep 24 08:34:11 2011

This archive was generated by hypermail 2.1.8 : Mon Sep 26 2011 - 14:45:50 MDT