User Profile

Collapse

Profile Sidebar

Collapse
jenya56
jenya56
Last Activity: Dec 23 '09, 12:21 AM
Joined: Nov 28 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • jenya56
    started a topic second run of my program

    second run of my program

    I have a very large object. When I run my program first time it runs just fine. But if I want to re-run it it fails by saying that it is out of memory. Any suggestions? Perhaps, should I call destractor (sp?) after I am done working with my object and need to run my program the second time. I am not sure how to do it. Perhaps, is there a function in python that clears all the memory? Thanks.
    See more | Go to post

  • jenya56
    started a topic pickle

    pickle

    Dear all,
    I have the following error:
    "CPickle.dump(l oclist,fout) Memory Error". This error occurs when I am trying to use the function "Locations_to_f ile" (see below) as I think my object loclist is too big.
    Code:
        def Locations_to_file(loclist,fname):
              '''Routine to help write a list of location objects to a file'''
              try:
                fount = open(fname,"wb")
    ...
    See more | Go to post
    Last edited by bvdet; Dec 22 '09, 03:42 PM. Reason: Add code tags

  • jenya56
    started a topic plotting

    plotting

    Dear all, I was wondering if there is equivalent in python of this Matlab function:
    PLOTCLR(X,Y,V) plots the values specified in V as a color coded scatter plot at the locations specified in the vectors X and Y. The current colormap of the figure is used for the color code. Any suggestions? Thanks.
    See more | Go to post

  • jenya56
    started a topic I have two numpy arrays

    I have two numpy arrays

    of not equal length. How to find the elements that are both in array1 and array2? Thanks!!!
    See more | Go to post

  • jenya56
    replied to what is wrong with this line
    well, I have array a=['0','1','2','3']. I need now to do the following val1='9', then set
    a=['0',['1','9'],'2','3']. Is there a way to do it? Thanks.
    See more | Go to post

    Leave a comment:


  • jenya56
    started a topic difference: repr(a) and str(a)

    difference: repr(a) and str(a)

    In my program, I have value a=0.24
    when I say : str(a) it prints 0.24
    when I say: repr(a) ir print '0.24'
    Why does str(a) not work? Thanks
    See more | Go to post

  • jenya56
    replied to what is wrong with this line
    Yes, I did print all of these.....
    However, in my program I have:
    Code:
     if coord_ind == None:
        ncdc_station.append(data_ncdc[il][3])
     else:
        ncdc_station[coord_ind[0]].extend(data_ncdc[il][3])
    In this program append works just fine but then I go to extend it does not. I thought that if extend does not work, append will not either?
    Could you please help me to correct this problem. THANKS
    See more | Go to post
    Last edited by bvdet; Dec 1 '09, 10:54 PM. Reason: Add code tags

    Leave a comment:


  • jenya56
    started a topic what is wrong with this line

    what is wrong with this line

    Code:
    list[1].extend(data_ncdc[il][3])
    it gives me an error that 'str' object has no attribute 'extend'. but I also tried
    Code:
    list[1].extend(float(data_ncdc[il][3]))
    Anybody? THANKS
    See more | Go to post
    Last edited by bvdet; Dec 1 '09, 09:36 PM. Reason: Add code tags

  • jenya56
    started a topic numpy and python array index question

    numpy and python array index question

    Dear all:

    I have this function and it works just fine but it is slow:

    Code:
    def common_index(list1, list2, val1, val2):
       assert len(list1) == len(list2), "List not of equal length"
       for i in range(len(list1)):
          if list1[i] == val1 and list2[i] == val2:
             return [i] 
    To optimize it:
    coord_ind=numpy.where(list1==val1 and list2==val2)
    Yet this line does not work...
    See more | Go to post
    Last edited by bvdet; Dec 1 '09, 09:35 PM. Reason: Add code tags

  • jenya56
    started a topic optimization problem

    optimization problem

    My program runs but it is soooooooooo slow. I have lots of data files I am reading and this for loop is where the program takes FOREVER.......N ote I declare data_ncdc=[] and ncdc_station=[]. Any suggestions would be appreciated.... . THANKS!!!!!
    Code:
    for il in range(len(data_ncdc)):
       coord_ind = common_index(ave_lon_ncdc,ave_lat_ncdc, data_ncdc[il][0],  data_ncdc[il][1])
         if coord_ind == None:
            ave_lon_ncdc.append(float(data_ncdc[il][0]))
    ...
    See more | Go to post
    Last edited by bvdet; Dec 1 '09, 09:32 PM. Reason: Add code tags

  • jenya56
    replied to two simple questions about arrays
    Hi, I was wondering if you could help me again....How do I add something to numpy array? Say I have :
    >>> a= numpy.zeros(0)
    Then I want to start adding elements to a. By the end I want a to look something like this a=[[1, 2], [4]]. I have no problem doing it with the actual python lists.
    See more | Go to post

    Leave a comment:


  • jenya56
    replied to two simple questions about arrays
    THANK YOU so much....
    See more | Go to post

    Leave a comment:


  • jenya56
    replied to two simple questions about arrays
    but here you assume you know the size of your array

    I do not know the size....
    See more | Go to post

    Leave a comment:


  • jenya56
    started a topic two simple questions about arrays

    two simple questions about arrays

    Dear all:
    1.) how to initilize numpy array? I need something similar to:
    data = []
    2.) how to add elements to nested lists?
    I have list a:
    a= [[1 2][1 2 3 3]]
    how to append something to a[0]
    THANKS SO MUCH.
    See more | Go to post
No activity results to display
Show More
Working...