Creation of Netcdf file

From: louis Vonder <appopson_at_nyahnyahspammersnyahnyah>
Date: Wed, 20 Feb 2008 18:34:57 +0100 (CET)

Dear Ncl users,
I am using a modified version of Ncl script to create
Netcdf file. My version is attached here.

After modifications of the following lines, I get the
same plot. There is no change in the plot when my
first latitude (ini_lat) begin with 1 or with 15.

What is the Problem here?

nlat = 58
xlat = new((/nlat/), "float")
ini_lat = 1.
do ii = 0, nlat - 1
    xlat(ii) = ini_lat
    ini_lat = ini_lat + 0.25
end do

My NCL script

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"

begin

nlat = 58
xlat = new((/nlat/), "float")
ini_lat = 1.
do ii = 0, nlat - 1
    xlat(ii) = ini_lat
    ini_lat = ini_lat + 0.25
end do

;lat = xlat(::-1)
lat = xlat

nlon = 66
xlon = new((/nlon/), "float")
ini_lon = 1.5
do ii = 0, nlon - 1
    xlon(ii) = ini_lon
    ini_lon = ini_lon + 0.25
end do

lon = xlon

  lat_at_units = "degrees_north"
  lat_at_long_name = "latitude"
  lon_at_units = "degrees_east"
  lon_at_long_name = "longitude"

  
  fili = systemfunc("ls FFL_3h_*_235K.txt")
  nfil = dimsizes( fili )

    do n=0, nfil - 1
       name = stringtocharacter(fili(n))
       name1 = name(0:16)
       name2 = chartostring(name1)

       dummy_data = asciiread(fili(n), (/nlat,nlon/),
"float")
  
; Set up coordinate arrays so we can overlay on map.
  dummy_data!0 = "lat"
  dummy_data!1 = "lon"
  dummy_data&lat = lat
  dummy_data&lon = lon
  dummy_data_at_units = "%"
  dummy_data@_FillValue = -9999.
  dummy_data_at_missing_value = dummy_data@_FillValue
   dummy_data_at_long_name = "Fractional coverage"

        diro = "./" ; Output
directory
        filo = name2+".nc" ; Output file
        system("/bin/rm -f " + diro + filo) ; remove if
exists
        fout = addfile (diro + filo, "c") ; open output
file

;===================================================================
    ; explicitly declare file definition mode. Improve
efficiency.
   
;===================================================================
        setfileoption(fout,"DefineMode",True)

 
;===================================================================
    ; create global attributes of the file
   
;===================================================================
        fAtt = True ; assign
file attributes
        fAtt_at_title = "NCL Efficient Approach to
netCDF Creation"
        fAtt_at_source_file = name
        fAtt_at_Conventions = "None"
        fAtt_at_creation_date = systemfunc ("date")
        fileattdef( fout, fAtt ) ; copy file
attributes
   
;===================================================================
    ; predefine the coordinate variables and their
dimensionality
    ; note: to get an UNLIMITED record dimension, we
set the dimensionality
    ; to -1 and set the unlimited array to True.
   
;===================================================================
        dimNames = (/ "lat", "lon" /)
        dimSizes = (/ nlat, nlon /)
        dimUnlim = (/ False, False /)
        filedimdef(fout, dimNames, dimSizes, dimUnlim)

     
       filevardef(fout, "lat" ,typeof(lat),"lat")
                     
       filevardef(fout, "lon" ,typeof(lon),"lon")
                     
       filevardef(fout, "FC", typeof(dummy_data),
(/"lat" ,"lon"/))

       filevarattdef(fout,"lat",lat)
    ; copy lat attributes
       filevarattdef(fout,"lon",lon)
    ; copy lon attributes
       filevarattdef(fout,"FC", dummy_data)
    ; copy TOPOG attributes

        setfileoption(fout,"DefineMode",False)

       fout->lat = (/lat/)
       fout->lon = (/lon/)
       fout->FC = (/dummy_data/)

delete(dummy_data)
delete(fout)

   end do
 

end

      _____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 20 2008 - 10:34:57 MST

This archive was generated by hypermail 2.2.0 : Wed Feb 20 2008 - 13:04:58 MST