jschap1 / vicglobal-prep

MATLAB scripts for preparing the VICGlobal soil, vegetation, and elevation band parameter files.
5 stars 2 forks source link

Problem in subset_soils.m #1

Open XiaoXiaoLeisure opened 1 year ago

XiaoXiaoLeisure commented 1 year ago

I input a basin mask shapefile in "subset_soils.m", while I came into this problem "Unrecognized function or variable dem, error subset_soils (line 94) if dem(i,j) == 0 || isnan(dem(i,j))", I am not sure the right format of the input "extent" file in "soils_subset = subset_soils(soils, extent, outname, outformat, grid_decimal, generate_tif, setup);", a normal shapefile in WGS1984 coordinate system, or a dem tiff file, or a basin mask file with 0 and 1?

Looking forward to your reply!

jschap1 commented 1 year ago

Hi Xiao,

The error message means that the variable "dem" was not found. It is possible that the input needs to be a raster, not a shapefile, but I don't remember exactly. GeoTIFF files (like those continent geotiffs included with the VICGlobal download) should work for sure. You can open the subset_soils code and see what kind of input it takes.

Sorry I am defending my thesis in a couple weeks, so I don't have much time to look into this right now.

Jacob

On Thu, Feb 23, 2023 at 5:38 PM Lixiao @.***> wrote:

I input a basin mask shapefile in "subset_soils.m", while I came into this problem "Unrecognized function or variable dem, error subset_soils (line 94) if dem(i,j) == 0 || isnan(dem(i,j))", I am not sure the right format of the input "extent" file in "soils_subset = subset_soils(soils, extent, outname, outformat, grid_decimal, generate_tif, setup);", a normal shapefile in WGS1984 coordinate system, or a dem tiff file, or a basin mask file with 0 and 1?

Looking forward to your reply!

— Reply to this email directly, view it on GitHub https://github.com/jschap1/vicglobal-prep/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDOCWMEC3O47R3DMCEU2UDWZAGKTANCNFSM6AAAAAAVGKSMNU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Jacob Schaperow University of California, Los Angeles (301) 466-5948 @.***

XiaoXiaoLeisure commented 1 year ago

Thank you for your reply. I have checked the code in "subset_soils.m" and I found that the variable "dem" is a global variable and used as a judgment in line 94~96, which leads to the input error.

Good Luck with your thesis defense!

XiaoXiaoLeisure commented 1 year ago

Can you give me some advice on how to cut the VICGlobal parameter dataset into my own basin and resample to my expected resolution, like resolution=1/4? I modified the code in "subset_soils.m" but there are no option to resampel to my resolution?

jschap1 commented 1 year ago

Thanks. There are no global variables in subset_soils.m. The input file should be a geotiff file. You can refer to e.g. the namerica.tif file included with VICGlobal for reference.

Regarding resampling, if you can, you might have an easier time working with the VIC5 Image inputs (NetCDF) files because I've already written subsetting files for both the domain and parameter files, while subsetting the classic mode vegetation file is more of a pain (although it is not necessary to subset it if you are using VICGlobal out of the box).

Another option you may have is to run VIC at 1/16 degree resolution and then aggregate the outputs to your desired resolution.

Link to VICGlobal: VICGlobal

XiaoXiaoLeisure commented 1 year ago

Thankyou for your advice!

I have only tried VIC4.2.d. I will try VIC 5 later.

I'm working on choosing parameters for the VIC model these days. And I tried a GUI matlab toolbox developed by Sungwook Wi——“VIC-ASSIST”, which employed the Genetic Algorithm to choose the best hydrological parameters and routing parameters (he rewrote the Lohmann routing model in C ). But it's really time-consuming on my own PC, only 16GB of memory.

So do you have any good idea of choosing parameters for the VIC model on PC or on Linux server? Since I have a large basin but only one measured outlet runoff data. I expect to run VIC at 1/4 degree resolution and 40 years.

jschap1 commented 1 year ago

Sure. VIC can take a lot of time to run, depending on how many grid cells are in your basin and how many time steps you want to run. One option is to use parallel computing to run VIC faster. Since grid cells are independent in VIC, you can run each grid cell on a separate processor to speed up computation, if necessary. I've done this with VIC4.2.d and VIC-5 Classic. It might be a good idea to do this if you are using something like VIC-ASSIST to calibrate VIC parameters because you may need to run VIC hundreds or thousands of times to find good parameter values.

Another option that has been done in the past is using trial and error to select parameters. What you would do in this case is select particular parameters that you believe are "sensitive" (there are some studies on this - a recent one is Gou et al., and try a few different values until you get a VIC run with a decently good match to your calibration data (e.g. discharge at the outlet).

XiaoXiaoLeisure commented 1 year ago

It really helps a lot! I guess I'm going to take a lot of trial and experiments! Thanks for your time!