dnychka / fieldsRPackage

GNU General Public License v2.0
15 stars 3 forks source link

fields::circulantEmbeddingSetup question #6

Closed DanWismer closed 2 months ago

DanWismer commented 2 months ago

Hi,

I am getting this error if (any(d < 0)) stop("distance argument must be nonnegative"): missing value where TRUE/FALSE needed when running the follow function:

  # create object for simulation
  obj <- fields::circulantEmbeddingSetup(
    grid = list(
      x = seq(0, 5, length.out = terra::nrow(x)),
      y = seq(0, 5, length.out = terra::ncol(x))
    ),
    Covariance = "Exponential",
    aRange = scale
  )

I am unsure how to debug this one. Wondering if you had any suggestions?

Thanks!

dnychka commented 2 months ago

Your call looks OK. Did you check the nrow(x) and ncol(x) ?

Douglas Nychka Personal email Cell 3037253199

From: Dan Wismer @.> Date: Friday, August 23, 2024 at 10:46 AM To: dnychka/fieldsRPackage @.> Cc: Subscribed @.***> Subject: [dnychka/fieldsRPackage] fields::circulantEmbeddingSetup question (Issue #6)

Hi,

I am getting this error if (any(d < 0)) stop("distance argument must be nonnegative"): missing value where TRUE/FALSE needed when running the follow function:

create object for simulation

obj <- fields::circulantEmbeddingSetup(

grid = list(

  x = seq(0, 5, length.out = terra::nrow(x)),

  y = seq(0, 5, length.out = terra::ncol(x))

),

Covariance = "Exponential",

aRange = scale

)

I am unsure how to debug this one. Wondering if you had any suggestions?

Thanks!

— Reply to this email directly, view it on GitHubhttps://github.com/dnychka/fieldsRPackage/issues/6, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADHJ7UZQAFXAMJHG7GMADODZS5RP5AVCNFSM6AAAAABNAQPR5CVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ4DGNJQGU3TSMY. You are receiving this because you are subscribed to this thread.Message ID: @.***>

DanWismer commented 2 months ago

Thanks,

terra::nrow(x) = 1 AND terra::ncol(x) = 2

dnychka commented 2 months ago

This function is designed for large problems e.g. grids of 100X100 and larger. I did not write it to handle a grid of just on point which is what nrow is.

You should just use the simpler function sim.spatialProcess.

Douglas Nychka Personal email Cell 3037253199

From: Dan Wismer @.> Date: Monday, August 26, 2024 at 10:53 AM To: dnychka/fieldsRPackage @.> Cc: Douglas Nychka @.>, Comment @.> Subject: Re: [dnychka/fieldsRPackage] fields::circulantEmbeddingSetup question (Issue #6)

Thanks,

terra::nrow(x) = 1 AND terra::ncol(x) = 2

— Reply to this email directly, view it on GitHubhttps://github.com/dnychka/fieldsRPackage/issues/6#issuecomment-2310645731, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADHJ7U6WPHRFOVI64DCQIOLZTNMRFAVCNFSM6AAAAABNAQPR5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGY2DKNZTGE. You are receiving this because you commented.Message ID: @.***>

DanWismer commented 2 months ago

Thanks for your responses dynchka, my data going into the function was the problem as you mentioned. Cheers.