[ncl-talk] Selecting a Subset of Lat/Long Points from a wrfinput_d01 File

Andrew Schwartz aschwa at ucar.edu
Wed Mar 8 16:47:24 MST 2017


Hi guys,

I am working on changing the smois values within my wrfinput_d01 file so
that we can examine the various effects of soil moisture on different
atmospheric parameters. I have an ncl script that does this for all the
values in the CONUS, but I need to change only a small subset of the actual
values that's roughly the size of Colorado. I have never written an ncl
script and am stumped currently. Are there any built-in functions that
might make this easier or do I need to go another route? My current code is
below.

Thanks!

-Andrew

=======================================================================

;=============
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/wrf/WRFUserARW.ncl"
;=============

;---Open file to rewrite
  f = addfile("wrfinput_d01","w")

;---Read data
  data_read = f->SMOIS(:,:,:,:)

print("==================================================================")
  printVarSummary(data_read)
  print("min/max data_read = " + min(data_read) + "/" + max(data_read))

  data_new = data_read * 1.3


print("==================================================================")
  printVarSummary(data_new)
  print("min/max data_read = " + min(data_new) + "/" + max(data_new))


print("==================================================================")
  print("================= Outputting Data to File
========================")

print("==================================================================")


;---Write out new data
  f->SMOIS = data_new

;---Close file.
  delete(f)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170308/49a318f8/attachment.html 


More information about the ncl-talk mailing list