Changing Land Use Categories in a WRF Input File

Any problems/questions that might not fall into the other topics in this category.

Changing Land Use Categories in a WRF Input File

Postby DW9900 » Sun May 02, 2021 5:56 pm

Hello,

I am trying to run an experiment where the land use category is changed from farmland to grassland. I am using USGS Land Use Categories. I made a custom NCL script to do so. I don't know why it only changed several farmland tiles compared to all the tiles like I intended. Here is the script I used to change my land use categories. I can't use the read_wrf_nc program since I'm using an HPC to power WRF so that's why I used a custom script.

Code: Select all
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
;load inner and outer domain input files
a = addfile("/common/hprcc/dwhitesel/WRF/test/em_real/wrfinput_d01.nc","w") ;outer domain, write
b = addfile("/common/hprcc/dwhitesel/WRF/test/em_real/wrfinput_d02.nc","w") ;inner domain, write

LUFrac1= a->LU_INDEX
LUFrac2= b->LU_INDEX

dims1 = dimsizes(LUFrac1)
dims2 = dimsizes(LUFrac2)

opt2d = True
opt2d@returnInt = True

bleh1la = 0.
bleh1lo = 0.
cc = 0

LUModCounter1 = 0
LUModCounter2 = 0

print(dims1)
print(dims2)

lat2d = a->XLAT(0,:,:)
lon2d = a->XLONG(0,:,:)
LAT2D = b->XLAT(0,:,:)
LON2D = b->XLONG(0,:,:)

dims3 = dimsizes(lat2d)
dims4 = dimsizes(lon2d)
dims5 = dimsizes(LAT2D)
dims6 = dimsizes(LON2D)

print(dims3)
print(dims4)
print(dims5)
print(dims6)

;loop through outer domain

;do i = 0, dims1(0)-1
;   do j = 0, dims1(1)-1
;      if(LUFrac1(0,i,j) .eq. 2 .or. LUFrac1(0,i,j) .eq. 3 .or. LUFrac1(0,i,j) .eq. 4 .or. LUFrac1(0,i,j) .eq. 5 .or. LUFrac1(0,i,j) .eq. 6) then ;if agriculture tiles
;         LUFrac1(0,i,j) = 7
;         LUModCounter1 = LUModCounter1 + 1
;      end if
;   end do
;end do

;loop through inner domain

;do k = 0, dims2(0)-1
;   do l = 0, dims2(1)-1
;      if (LUFrac2(0,k,l) .eq. 2 .or. LUFrac2(0,k,l) .eq. 3 .or. LUFrac2(0,k,l) .eq. 4 .or. LUFrac2(0,k,l) .eq. 5 .or. LUFrac2(0,k,l) .eq. 6) then ;if land use is agriculture
;         LUFrac2(0,k,l) = 7
;         LUModCounter2 = LUModCounter2 + 1
;      end if
;   end do
;end do

;a->LU_INDEX(:,:,:) = LUFrac1
;b->LU_INDEX(:,:,:) = LUFrac2

;print ("Outer domain converted: " + LUModCounter1 + "tiles to grassland.")
;print ("Inner domain converted: " + LUModCounter2 + "tiles to grassland.")

end




DW9900
 
Posts: 1
Joined: Sun Apr 18, 2021 8:04 pm

Return to Miscellaneous

Who is online

Users browsing this forum: No registered users and 1 guest