Re: modify netCDF data and save (updated + code)

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sun, 02 Dec 2007 19:43:10 -0700

In my opinion, what you did is fine. Perhaps adding the
following print statements will provide come insight.

a = addfile("/home/blw3g/wrf/WRFV2/run/guan.nc","w")
   dimS = filevardimsizes(a,"SMOIS")
   print(dimS)
   print("---")
soil = wrf_user_getvar(a,"SMOIS",it)
   print(dimsizes(soil))
soil = soil*0.2
a ->SMOIS=(/soil/)

Good luck

Guan Song wrote:
>
>
>
>
> Hi
>
> Sorry to send again but I update with my code, it seems work but still
> have problems. As code shows, I would like to change initial soil
> moisture fields but I can only change to uniform values (o) since the
> dimension is not balanced.
>
> I highlighted the code that I have some problems
>
> I want to use NCL to modify wrfinput_d01.nc file
>
> In
> my project, I want to do the sensitivity test of initial soil moisture.
> So I decided to modify the initial soil moisture value in
> wrfinput_d01.nc file.
>
> I can use NCL to read SMOIS from wrfinput_d01 file and plot it.
>
> However, I am not sure how to modify SMOIS values and still save in the
> wrfinput_d01.nc file.
>
> Can you give me some suggestions?
>
> Thank you so much,
> Guan
>
>
> ----------------------------------------------------------------------------
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
>
> a=addfile("/home/blw3g/wrf/WRFV2/run/guan.nc","w")
> type="x11"
> wks=gsn_open_wks(type,"plt_Surface")
>
> ARWres=True
> ARWres_at_MainTitle="REAL-TIME WRF"
>
> times=wrf_user_list_times(a) ; GET TIMES IN THE FILE
> ntimes=dimsizes (times) ;NUMBER OF TIMES IN THE FILE
>
> do it=0,2 ;WE ARE ONLY INTERESTED IN THE LAST TIME
> ARWres_at_TimeLabel = times (it);keep some time information
> mpres=True
> map=wrf_map(wks,a,mpres)
>
> soil=wrf_user_getvar(a,"SMOIS",it)
>
> ;sltyp=wrf_user_getvar(a,"IVGTYP",it)
> ;ivgtyp=wrf_user_getvar(a,"ISLTYP",it)
>
> a ->SMOIS=(/0/) ; this statement currently work but total grids are
> uniform as 0
>
> ***********
> ;soil=soil*0.2 ;; this is my idea so I can make initial soil moisture
> still heterogeneity
> ;a ->SMOIS=(/soil/) ;;but it did not work since the right hand and left
> hand dimension did not balance
> **********
> opts=ARWres
>
> ;contour_veg=wrf_contour(a,wks,ivgtyp(:,:),opts)
> contour_soil=wrf_contour(a,wks,soil(:,:,1),opts)
> opts= ARWres
>
> wrf_map_overlay(wks,map,(/contour_soil/),True)
> ;wrf_map_overlay(wks,map,(/contour_sty/),True)
> ;wrf_map_overlay(wks,map,(/contour_veg/),True)
> end do
>
> end
>
> --------------------------------------------------------------------------------------------
>
> ________________________________
>
> ------------------------------------------------------------------------
> Get the power of Windows + Web with the new Windows Live. Power up!
> <http://www.windowslive.com?ocid=TXT_TAGLM_Wave2_powerofwindows_112007>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Dec 02 2007 - 19:43:10 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 31 2008 - 22:46:00 MST