This part of a larger code code will Create two two-dimensional arrays with nlon
ID: 669578 • Letter: T
Question
This part of a larger code code will Create two two-dimensional arrays with nlon by nlat elements and set all values in the two arrays to 0 in matlab. CONVERT THIS PART OF THE CODE TO PYTHON LANGUAGE. THERE MUST BE NO ASPECTS OF matlab language as it must work in PYTHON (so end can't be used along with undefined variables like mslice). Don't worry about what exceed consectuive does. Just convert the language to PYTHON.
nday = zeros(nlon, nlat);
nday_consecutive = zeros(nlon, nlat);
for ii = 1:nlon
for jj = 1:nlat
nday(ii,jj,:) = exceed(tempF(ii,jj,:), threshold);
nday_consecutive(ii,jj,:) = max(...
exceed_consecutive(tempF(ii,jj,:), threshold));
end
end
Explanation / Answer
Python Basics
About Python: Python is a high level scripting language with object oriented features.
#!/usr/bin/pythonif (x > y):
print("x is greater than y")
x = x -1
else:
print("x is less than or equal to y") Comments are supported in the same style as Perl:
print("This is a test") #This is a comment.
#This is also a comment. There are no multi-line comments.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.