# problem with assigning coordinates

Date: Thu, 16 Nov 2006 16:41:12 -0600

Hello, my name is Gaby, I made a program where i opened some GRB files and I
calculated the sum of every 8 files, and i saved it in a new netcdf file but
this file i canīt open with grads because it says that the x coordinate is
not defined. I think that the problem is in assigning the coordinates
(latitude y longitude) in the sum for the new file. The grb file has
dimension gridx_221 and gridy_221 and has 2d lat/lon vars lat
(gridx_221,gridy_221) and lon(gridx_221,gridy_221).

Also i would like for you to provide me whith some tips to improve my
program. Thanks a lot.

The program is:

;******************
begin
;******************

diri = "/home/gaby/datos/1995/grb/"
diri2 = "/home/gaby/datos/1995/"
fil = systemfunc ("ls " +diri+"narra3ss19950101*")

ListSetType (f1, "join")

;******************
;create a netcdf
;******************
system ("rm "+diri2+"sumas.nc")
;******************

pcp = f1[:]->A_PCP_221_SFC_acc3h
lat = f1[0]->gridlat_221
lon = f1[0]->gridlon_221
lon!0 = "lon"
lon!1 = "lat"
lat!0 = "lon"
lat!1 = "lat"

dimll = dimsizes(lat)
nlon = dimll(0)
nlat = dimll(1)
time = fspan (0,7,8)

pcp!0 = "time"
pcp!1 = "lon"
pcp!2 = "lat"

temp = (pcp(lat|:,lon|:,time|:))

ntime = 7
ppt = temp(0::ntime/8-1,:,:)

ntime2 = 1
time2 = 1 + ispan (0,ntime2-1,1)

suma = new ((/nlat,nlon,ntime2/), typeof(temp),temp@_FillValue)

cntr = 0
do gg = 0,ntime-2,8 ; increment do loop by 8
suma(:,:,cntr) = (/dim_sum(temp(:,:,gg:gg+7)) /)
cntr = cntr+1
end do

suma!0 = "lat"
suma!1 = "lon"
suma!2 = "time"

suma2 = (suma(time|:,lat|:,lon|:))

;******************
;out file
;******************

lon2 = lon(lat|:,lon|:)
lat2 = lat(lat|:,lon|:)

dimNames = (/ "time","lat","lon"/)
dimSizes = (/ -1,nlat,nlon/)
dimUnlim = (/ True,False,False/)
filedimdef(ncdf,dimNames,dimSizes,dimUnlim)

filevardef(ncdf, "time" ,typeof(time2),(/"time"/))
filevardef(ncdf, "prec" ,typeof(suma2),(/"time","lat","lon"/))

ncdf_at_lat = lat
ncdf_at_lon = lon
ncdf_at_source = f1

sumas2_at_lat2d =lat2
sumas2_at_lot2d = lon2

ncdf->time = (/time2/)
ncdf->lat = lat2
ncdf->lon = lon2
ncdf->prec = (/suma2/)
ncdf_at_long_name = "Precipitacion diaria"
ncdf_at_units = "mm/dia"

end

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 16 2006 - 15:41:12 MST

This archive was generated by hypermail 2.2.0 : Sat Nov 18 2006 - 15:30:26 MST