Writing multiband raster from 3d numpy array gives an errorWriting numpy array to raster fileFinding...
Traveling to heavily polluted city, what practical measures can I take to minimize impact?
Can I take the the bonus-action attack from Two-Weapon Fighting without taking the Attack action?
Why aren't there more Gauls like Obelix?
Did Amazon pay $0 in taxes last year?
Difference between `nmap local-IP-address` and `nmap localhost`
Can one live in the U.S. and not use a credit card?
Is "cogitate" used appropriately in "I cogitate that success relies on hard work"?
I am the person who abides by rules, but breaks the rules. Who am I?
What would be the most expensive material to an intergalactic society?
Having the player face themselves after the mid-game
ESPP--any reason not to go all in?
What can I do if someone tampers with my SSH public key?
"If + would" conditional in present perfect tense
When an outsider describes family relationships, which point of view are they using?
Is there a math expression equivalent to the conditional ternary operator?
What will happen if my luggage gets delayed?
What is this tube in a jet engine's air intake?
How do we create new idioms and use them in a novel?
Professor forcing me to attend a conference, I can't afford even with 50% funding
Are all players supposed to be able to see each others' character sheets?
Cycles on the torus
Can't make sense of a paragraph from Lovecraft
How to copy the rest of lines of a file to another file
What does the Digital Threat scope actually do?
Writing multiband raster from 3d numpy array gives an error
Writing numpy array to raster fileFinding coordinates from nested grid as numpy array?Converting LAS file to numpy array?Is it possible to open rasters as array in NumPy without using another library?Print last digit in Numpy ArrayPossible to resample tifs in numpy array?Numpy Array to ArcGIS GRID gives ValueError?Create raster map from numpy arrayWriting a raster file from multi-dimension array using PythonWriting numpy array to rasterio raster file generates empty file
Please, help to fix this code. I tried to filter multiband (240 bands) raster as numpy array:
import rasterio
import numpy as np
from scipy.signal import savgol_filter
with rasterio.open('D:/Articles_Data/RasterData/MYD13Q1Y2003Y2018clip.tif',
'r+') as ds:
arr = ds.read() # read all raster values
y = savgol_filter(arr, 7, 3, mode='nearest')
y=y.astype('float32') # change the data type to float rather than
integer
data=np.where(
y==0.,
0,
y/10000
)
ds.write(arr)
naip_data_ras = ds.read()
naip_meta = ds.profile
naip_meta
naip_transform = naip_meta["transform"]
naip_crs = naip_meta["crs"]
# View spatial attributes
naip_transform, naip_crs
# write your the ndvi raster object
with
rasterio.open('D:/Articles_Data/RasterData/MYD13Q1Y2003Y2018denoiseCCC.tif',
'w', **naip_meta) as dst:
dst.write(data, 1)
It generates this error: the array's dtype 'float32' does not match the file's dtype 'int16'.
Thank you very much. Any additional bits of advice will be very useful.
python raster numpy array large-datasets
New contributor
add a comment |
Please, help to fix this code. I tried to filter multiband (240 bands) raster as numpy array:
import rasterio
import numpy as np
from scipy.signal import savgol_filter
with rasterio.open('D:/Articles_Data/RasterData/MYD13Q1Y2003Y2018clip.tif',
'r+') as ds:
arr = ds.read() # read all raster values
y = savgol_filter(arr, 7, 3, mode='nearest')
y=y.astype('float32') # change the data type to float rather than
integer
data=np.where(
y==0.,
0,
y/10000
)
ds.write(arr)
naip_data_ras = ds.read()
naip_meta = ds.profile
naip_meta
naip_transform = naip_meta["transform"]
naip_crs = naip_meta["crs"]
# View spatial attributes
naip_transform, naip_crs
# write your the ndvi raster object
with
rasterio.open('D:/Articles_Data/RasterData/MYD13Q1Y2003Y2018denoiseCCC.tif',
'w', **naip_meta) as dst:
dst.write(data, 1)
It generates this error: the array's dtype 'float32' does not match the file's dtype 'int16'.
Thank you very much. Any additional bits of advice will be very useful.
python raster numpy array large-datasets
New contributor
add a comment |
Please, help to fix this code. I tried to filter multiband (240 bands) raster as numpy array:
import rasterio
import numpy as np
from scipy.signal import savgol_filter
with rasterio.open('D:/Articles_Data/RasterData/MYD13Q1Y2003Y2018clip.tif',
'r+') as ds:
arr = ds.read() # read all raster values
y = savgol_filter(arr, 7, 3, mode='nearest')
y=y.astype('float32') # change the data type to float rather than
integer
data=np.where(
y==0.,
0,
y/10000
)
ds.write(arr)
naip_data_ras = ds.read()
naip_meta = ds.profile
naip_meta
naip_transform = naip_meta["transform"]
naip_crs = naip_meta["crs"]
# View spatial attributes
naip_transform, naip_crs
# write your the ndvi raster object
with
rasterio.open('D:/Articles_Data/RasterData/MYD13Q1Y2003Y2018denoiseCCC.tif',
'w', **naip_meta) as dst:
dst.write(data, 1)
It generates this error: the array's dtype 'float32' does not match the file's dtype 'int16'.
Thank you very much. Any additional bits of advice will be very useful.
python raster numpy array large-datasets
New contributor
Please, help to fix this code. I tried to filter multiband (240 bands) raster as numpy array:
import rasterio
import numpy as np
from scipy.signal import savgol_filter
with rasterio.open('D:/Articles_Data/RasterData/MYD13Q1Y2003Y2018clip.tif',
'r+') as ds:
arr = ds.read() # read all raster values
y = savgol_filter(arr, 7, 3, mode='nearest')
y=y.astype('float32') # change the data type to float rather than
integer
data=np.where(
y==0.,
0,
y/10000
)
ds.write(arr)
naip_data_ras = ds.read()
naip_meta = ds.profile
naip_meta
naip_transform = naip_meta["transform"]
naip_crs = naip_meta["crs"]
# View spatial attributes
naip_transform, naip_crs
# write your the ndvi raster object
with
rasterio.open('D:/Articles_Data/RasterData/MYD13Q1Y2003Y2018denoiseCCC.tif',
'w', **naip_meta) as dst:
dst.write(data, 1)
It generates this error: the array's dtype 'float32' does not match the file's dtype 'int16'.
Thank you very much. Any additional bits of advice will be very useful.
python raster numpy array large-datasets
python raster numpy array large-datasets
New contributor
New contributor
New contributor
asked 5 mins ago
KanatKanat
13
13
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Kanat is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f314958%2fwriting-multiband-raster-from-3d-numpy-array-gives-an-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Kanat is a new contributor. Be nice, and check out our Code of Conduct.
Kanat is a new contributor. Be nice, and check out our Code of Conduct.
Kanat is a new contributor. Be nice, and check out our Code of Conduct.
Kanat is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f314958%2fwriting-multiband-raster-from-3d-numpy-array-gives-an-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown