Save results to netcdf in NCL

From: Yuqiang Zhang <yuqiangzhang.thu_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 21 2013 - 16:29:01 MDT

Hi Everyone,

 

I am a new guy with NCL. Recently I wrote a code to save the outputs into
netcdf with NCL. However when the code was done, I used the "ncdump -h" to
check the header information of the new netcdfs, it gave me more dimensions
than I defined (see the yellow lines). However in the code, I only defined
these dimensions as (time, south_north, west_east). In the new netcdfs, I
have saved 8 variables with the same dimension of (south_north, west_east).
Not sure why there are so many "ncl*" variables.

 

The red ones are my codes. It is also attached.

 

"dimensions:

        time = UNLIMITED ; // (1 currently)

        south_north = 128 ;

        west_east = 164 ;

        ncl3 = 1 ;

        ncl4 = 128 ;

        ncl5 = 164 ;

        ncl6 = 128 ;

        ncl7 = 164 ;

        ncl8 = 128 ;

        ncl9 = 164 ;

        ncl10 = 128 ;

        ncl11 = 164 ;

        ncl12 = 128 ;

        ncl13 = 164 ;

        ncl14 = 128 ;

        ncl15 = 164 ;

        ncl16 = 128 ;

        ncl17 = 164 ;

        ncl18 = 128 ;

        ncl19 = 164 ;"

 

  fAtt = True ; assign file attributes

 fAtt@title = "NCL Efficient Approach to netCDF Creation"

  fAtt@units = "kg/m2/s"

  fAtt@source_file = src_file

  fAtt@Conventions = "Conserve from RCP"

  fAtt@creation_date = systemfunc ("date")

  fileattdef(outf, fAtt ) ; copy file attributes

  

  ;Define dimensions:

  dim_names = (/"time", "south_north","west_east"/)

  dim_sizes = (/-1, nlat(0),nlon(1)/)

  dim_unlimited = (/True, False,False/)

  

  print("Defining dimension sizes to be " + dim_sizes)

  filedimdef(outf,dim_names,dim_sizes,dim_unlimited)

 

  ;Define file variables

  filevardef(outf,"ROW","float",(/"south_north","west_east"/))

  filevardef(outf,"COL","float",(/"south_north","west_east"/))

  filevardef(outf,"time","float","time")

  filevardef(outf,"ind","float",(/"south_north","west_east"/))

  filevardef(outf,"ene","float",(/"south_north","west_east"/))

  filevardef(outf,"dom","float",(/"south_north","west_east"/))

  filevardef(outf,"tra","float",(/"south_north","west_east"/))

  filevardef(outf,"wst","float",(/"south_north","west_east"/))

  filevardef(outf,"agr","float",(/"south_north","west_east"/))

  filevardef(outf,"slv","float",(/"south_north","west_east"/))

  filevardef(outf,"awb","float",(/"south_north","west_east"/))

 

  ;Define file attributes

  print("Defining file variable attributes")

  tatts = True

  tatts@long_name = "elapsed time"

  tatts@format = "YYYYMMDD"

  filevarattdef(outf,"time",tatts)

  

  ;create arrays

  

  ;filedimdef(outf,"time",ntime,True)

  outf->ROW = dst_lat

  outf->COL = dst_lon

  outf->time = times(0)

  

  outf->ene = var_regrid_ene

  outf->dom = var_regrid_dom

  outf->ind = var_regrid_ind

  outf->tra = var_regrid_tra

  outf->wst = var_regrid_wst

  outf->agr = var_regrid_agr

  outf->slv = var_regrid_slv

  outf->awb = var_regrid_awb

 

 

I used the example from NCL website:

 

"Method 2: netCDF output with file predefinition"

http://www.ncl.ucar.edu/Applications/method_2.shtml

 

-----------------------------------------------------------------

-----------------------------------------------------------------

Yuqiang Zhang

PhD student

Environmental Science and Engineering Department

Univerisyt of North Carolina at Chapel Hill

 

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Fri Jun 21 16:29:21 2013

This archive was generated by hypermail 2.1.8 : Mon Jun 24 2013 - 11:46:47 MDT