Hello everyone:
I met an error when I am using the micro_terra function to calculate microclimate variables for a point(R v.4.3.1, NicheMapR v.3.3.2).
The following is a simple code and execution result of my workflow:
> library(NicheMapR) > library(RNetCDF) > library(terra)
> micro_result <- NicheMapR::micro_terra(
+ loc = c(10.661575, 46.213974),
+ ystart = 2000,
+ yfinish = 2000,
+ timeinterval=12,
+ scenario = 0,
+ minshade = 85,
+ maxshade = 90,
+ Usrhyt = 0.01,
+ terra_source = "D:\\Terraclimate1")
试开URL’https://geodata.ucdavis.edu/climate/worldclim/2_1/base/wc2.1_2.5m_elev.zip'
Content type 'application/zip' length 17566799 bytes (16.8 MB)
downloaded 16.8 MB
running micro_global to get clear sky solar
If program is crashing, try run.gads = 2.
extracting maximum air temperature data from TerraClimate for 2000
extracting minimum air temperature data from TerraClimate for 2000
extracting precipitation data from TerraClimate for 2000
extracting wind speed data from TerraClimate for 2000
extracting vapour pressure deficit data from TerraClimate for 2000
extracting solar radiation data from TerraClimate for 2000
extracting soil moisture data from TerraClimate for 2000
running micro_global to get clear sky solar
If program is crashing, try run.gads = 2.
extracting climate data
extracting soil moisture data
running microclimate model for 365 days by 1 years at site long 10.661575 lat 46.213974
Note: the output column `SOLR` in metout and shadmet is for unshaded horizontal plane solar radiation
runtime 0.410000000000025 seconds Error in NicheMapR::micro_terra(loc = c(10.661575, 46.213974), ystart = 2000, :
object 'diffuse_frac_all' not found
I looked into the underlying code of the micro_terra function, and I noticed that “diffuse_frac_all” is created when microclima = 0. However, I am using the default value of 0, so theoretically it should not be executed and created. I also tried explicitly specifying the parameter microclima = 0, but the error persists. I am a beginner in programming, so my understanding might be incorrect, but I really can't figure out where the problem lies. I would greatly appreciate it if you could help me take a look.
Thanks in advance!
With best regards,
Zi-Xuan