[ncl-talk] vertically distributing WRF-Chem emissions

Dennis Shea shea at ucar.edu
Fri Oct 21 08:06:13 MDT 2016


Well, you have to do better than "... but got an error:".
ncl-tal wants the error message?

===
Im order to use the way ypu were wriying to the file would require that you
had, apriori, defined the variable for the file via (say)
  http://www.ncl.ucar.edu/Document/Functions/Built-in/filevardef.shtml
Then you could write into the predefined locations.


===

The following is easier. It uses the simple method to write netCDF:

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

=======
  diri = "./"
  fili = "wrfchemi_00z_d01_pow_Oct.nc"
  a    = addfile(diri+fili,"r")

  SO2  =  a->E_SO2(:,0,:,:) ;;;;;EXTRACTING THE SURFACE EMISSIONS
  printVarSummary(SO2)

  dimSO2 = dimsizes(SO2)
  print(dimSO2)

  ntim   = dimSO2(0)
  nlat   = dimSO2(1)
  mlon   = dimSO2(2)
  klev   = 8

;;NOW PARTITIONING INTO 8 LEVELS
;;E_SO2 MUST BE PRE-ALLOCATED

  E_SO2 = new((/ntim,klev,nlat,mlon/),typeof(SO2),getVarFillValue(SO2))
  E_SO2(:,0,:,:) = 0.0 * SO2
  E_SO2(:,1,:,:) = 0.3 * SO2
  E_SO2(:,2,:,:) = 0.3 * SO2
  E_SO2(:,3,:,:) = 0.1 * SO2
  E_SO2(:,4,:,:) = 0.1 * SO2
  E_SO2(:,5,:,:) = 0.1 * SO2
  E_SO2(:,6,:,:) = 0.05 * SO2
  E_SO2(:,7,:,:) = 0.05 * SO2

  copy_VarMeta(SO2, E_SO2)
  printVarSummary(E_SO2)

;; add more meta data

  lev            = ispan(1,klev,1)   ; ??????
  lev!0         = "lev"
  lev at long_name = "level"
  lev at units     = "..."

  E_SO2!1     = "lev"    ; add coordinate variable
  E_SO2&lev =  lev

  E_SO2 at long_name = "artificial: "+SO2 at long_name
  printVarSummary(E_SO2)

  ;=================================
  diro = "./"
  filo = "dummy.nc"
  ptho = diro+filo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161021/e0afaf04/attachment.html 


More information about the ncl-talk mailing list