0

i need to copy a set of variables in python. what i do now is:

for var in variables:
  newvar[:] = var[:]

which works in my local machine since i have 16 gigs of ram at my dispose. Problem is on the development machine i'm supposed to use, there's only 1 gig of ram available, which cause Memory error. To fix this i thought to divide the lists i'm copying in chunks, However the variables involved could have an arbitrary level of nesting such as:

var1[100]
var2[50,100]
var3[20,30,50]

is there any library or process to copy the variables in chunks so that the chunks' size doesn't exceed the amount of the free ram available ?

thefourtheye
  • 233,700
  • 52
  • 457
  • 497
darkpirate
  • 712
  • 3
  • 10
  • 27
  • Can you clarify why you need to copy into memory? Usually, using iterators/streaming will allow you to process data without copying it upfront. – Karin Aug 08 '16 at 04:59
  • i need to delete some variables from a netcdf file, which isn't possible by itself, so i'm creating a copy of the file discarding the variables i don't need, for reference: http://stackoverflow.com/questions/6816613/how-to-delete-a-variable-in-a-scientific-io-netcdf-netcdffile – darkpirate Aug 08 '16 at 05:10

0 Answers0