Thank you all! It is clear now:)
Verstuurd vanaf mijn iPhone
> Op 28 okt. 2016 om 19:31 heeft Ben Finney het
> volgende geschreven:
>
> Alan Gauld via Tutor writes:
>
>>> On 28/10/16 02:38, nils wagenaar wrote:
>>> Could i use a variable defined in a function in another function?
>
> My ans
Alan Gauld via Tutor writes:
> On 28/10/16 02:38, nils wagenaar wrote:
> > Could i use a variable defined in a function in another function?
My answer would be: You can't because Python variables don't exist
outside their namespace.
You can make the object available in various ways, but not the
nils wagenaar wrote:
> Hello,
>
>
> Could i use a variable defined in a function in another function?
>
> I have now:
>
>
> def DatasetToSubset(file, LatUpbound, LatLowBound, LonUpBound,
> LonLowBound):
> nc=netCDF4.Dataset(file)
> lats=nc.variables['lat'][:]; lons=nc.variables['lon
On 28/10/16 02:38, nils wagenaar wrote:
> Hello,
>
>
> Could i use a variable defined in a function in another function?
By returning it to the caller.
> def DatasetToSubset(file, LatUpbound, LatLowBound, LonUpBound, LonLowBound):
> nc=netCDF4.Dataset(file)
> lats=nc.variables['lat'][
Hello,
Could i use a variable defined in a function in another function?
I have now:
def DatasetToSubset(file, LatUpbound, LatLowBound, LonUpBound, LonLowBound):
nc=netCDF4.Dataset(file)
lats=nc.variables['lat'][:]; lons=nc.variables['lon'][:]
latselect=np.logical_and(lats > Lat