How to specify nrows and ncols instead of latscale and lonscale in georesize?

4 Ansichten (letzte 30 Tage)
I am trying to rescale geotiffs using georesize. I have a required size [1527,3164] and I am extracting the latscale and lonscale based on these numbers. However, the following line in the georesize function is returning slightly different values (i.e., 1526, 3163 etc)
[RB, xSample, ySample] = scaleSizeAndDensity(RA, double(latscale), double(lonscale));
For example, the parameters A = 1493x3093 single, latscale = 1.0228, lonscale = 1.0230 should result in the required size, but the execution of the scaleSizeAndDensity is causing xSample = 3163, ySample = 1527. While the change is minor, it is causing dimension mismatch. I believe zero padding B will create a mismatch with it's corresponding RB. What can I do in this regard? Is there a way to specify this required size when I call georesize instead of latscale and lonscale while can create error because of the smaller decimal numbers?
Thanks.
  4 Kommentare
Farshina Nazrul Shimim
Farshina Nazrul Shimim am 14 Jul. 2022
Thanks for your response. I beleive size(RA, 1) is the same as RA.Rastersize(1). I've been doing that.
Thanks for your response. I added double(Latscale), double(Lonscale) it's not chaning anything unfortunately.
dpb
dpb am 14 Jul. 2022
Bearbeitet: dpb am 15 Jul. 2022
SHOW US THE EXACT CODE IN ITS ENTIRETY OF THE PERTINENT PART INSTEAD OF DESCRIBING IT.
Where you added double may or may not have any effect; you do not need an explicit double() statement at all; you'll probably be better off without. My comment above was only meant to ensure you hadn't created the variables as single() but were using (default) double precision in the calculations.
What we haven't seen is whether you actually computed the scaling factors or are still messing around trying to use constants as in your original...

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by