• How to turn this Matlab code into python

    From Dioumacor FAYE@21:1/5 to All on Mon Nov 7 17:12:12 2022
    hi everyone
    I wanted to transform this matlab code into python. If anyone can help me please let me know.
    load /media/lpaosf/Dioumss/maman/data/precip_chirps_SEN_1981-2018.mat
    prcp = reshape(precip,[140*100,13879]);
    dates = datenum(1981,1,1):datenum(2018,12,31);
    date = datevec(dates);
    ind_mjja=find(date(:,2)>=5 & date(:,2)<=8);% May to Aug (May(31)+ June(30)+ July(31)+ August(31)= 123 days)
    data_mjja=precp(:,ind_mjja);
    data_mjja_res=reshape(data_mjja,14000,123,38);
    --
    Bien à vous,
    --------------------- ------------------ ----------------- -------------------- -----------------
    Dioumacor FAYE doctorant au LPAOSF/ESP/UCAD/BP 5085 Dakar-Fann, Sénégal.
    Tel labo: (00221) 33 825 93 64
    Email: [email protected] <[email protected]> Tel: +221773475098 +221783484308
    Physicien en herbe
    Pseudo Skype: dioumacorfaye

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Gollwitzer@21:1/5 to All on Mon Nov 7 20:47:46 2022
    Am 07.11.22 um 18:12 schrieb Dioumacor FAYE:
    hi everyone
    I wanted to transform this matlab code into python. If anyone can help me please let me know.
    load /media/lpaosf/Dioumss/maman/data/precip_chirps_SEN_1981-2018.mat
    prcp = reshape(precip,[140*100,13879]);
    dates = datenum(1981,1,1):datenum(2018,12,31);
    date = datevec(dates);
    ind_mjja=find(date(:,2)>=5 & date(:,2)<=8);% May to Aug (May(31)+ June(30)+ July(31)+ August(31)= 123 days)
    data_mjja=precp(:,ind_mjja);
    data_mjja_res=reshape(data_mjja,14000,123,38);

    which part do you have trouble with?


    Christian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Gollwitzer@21:1/5 to All on Tue Nov 8 09:14:22 2022
    Am 08.11.22 um 09:01 schrieb Dioumacor FAYE:
    From datenum to data_mjja=precp(:,ind_mjja);

    I think the code filters data based on calendar dates. I'd guess that
    you can do that most easily with pandas.

    https://pandas.pydata.org/docs/user_guide/timeseries.html

    Christian

    Le lun. 7 nov. 2022 à 21:42, Christian Gollwitzer <[email protected]> a
    écrit :

    Am 07.11.22 um 18:12 schrieb Dioumacor FAYE:
    hi everyone
    I wanted to transform this matlab code into python. If anyone can help me >>> please let me know.
    load /media/lpaosf/Dioumss/maman/data/precip_chirps_SEN_1981-2018.mat
    prcp = reshape(precip,[140*100,13879]);
    dates = datenum(1981,1,1):datenum(2018,12,31);
    date = datevec(dates);
    ind_mjja=find(date(:,2)>=5 & date(:,2)<=8);% May to Aug (May(31)+
    June(30)+
    July(31)+ August(31)= 123 days)
    data_mjja=precp(:,ind_mjja);
    data_mjja_res=reshape(data_mjja,14000,123,38);

    which part do you have trouble with?


    Christian
    --
    https://mail.python.org/mailman/listinfo/python-list




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dioumacor FAYE@21:1/5 to All on Tue Nov 8 08:01:37 2022
    From datenum to data_mjja=precp(:,ind_mjja);

    Le lun. 7 nov. 2022 à 21:42, Christian Gollwitzer <[email protected]> a
    écrit :

    Am 07.11.22 um 18:12 schrieb Dioumacor FAYE:
    hi everyone
    I wanted to transform this matlab code into python. If anyone can help me please let me know.
    load /media/lpaosf/Dioumss/maman/data/precip_chirps_SEN_1981-2018.mat
    prcp = reshape(precip,[140*100,13879]);
    dates = datenum(1981,1,1):datenum(2018,12,31);
    date = datevec(dates);
    ind_mjja=find(date(:,2)>=5 & date(:,2)<=8);% May to Aug (May(31)+
    June(30)+
    July(31)+ August(31)= 123 days)
    data_mjja=precp(:,ind_mjja);
    data_mjja_res=reshape(data_mjja,14000,123,38);

    which part do you have trouble with?


    Christian
    --
    https://mail.python.org/mailman/listinfo/python-list



    --
    Bien à vous,
    --------------------- ------------------ ----------------- -------------------- -----------------
    Dioumacor FAYE doctorant au LPAOSF/ESP/UCAD/BP 5085 Dakar-Fann, Sénégal.
    Tel labo: (00221) 33 825 93 64
    Email: [email protected] <[email protected]> Tel: +221773475098 +221783484308
    Physicien en herbe
    Pseudo Skype: dioumacorfaye

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dioumacor FAYE@21:1/5 to All on Tue Nov 8 20:51:00 2022
    Merci beaucoup Christian pour le lien.

    Le mar. 8 nov. 2022 à 17:08, Christian Gollwitzer <[email protected]> a
    écrit :

    Am 08.11.22 um 09:01 schrieb Dioumacor FAYE:
    From datenum to data_mjja=precp(:,ind_mjja);

    I think the code filters data based on calendar dates. I'd guess that
    you can do that most easily with pandas.

    https://pandas.pydata.org/docs/user_guide/timeseries.html

    Christian

    Le lun. 7 nov. 2022 à 21:42, Christian Gollwitzer <[email protected]> a écrit :

    Am 07.11.22 um 18:12 schrieb Dioumacor FAYE:
    hi everyone
    I wanted to transform this matlab code into python. If anyone can help
    me
    please let me know.
    load /media/lpaosf/Dioumss/maman/data/precip_chirps_SEN_1981-2018.mat
    prcp = reshape(precip,[140*100,13879]);
    dates = datenum(1981,1,1):datenum(2018,12,31);
    date = datevec(dates);
    ind_mjja=find(date(:,2)>=5 & date(:,2)<=8);% May to Aug (May(31)+
    June(30)+
    July(31)+ August(31)= 123 days)
    data_mjja=precp(:,ind_mjja);
    data_mjja_res=reshape(data_mjja,14000,123,38);

    which part do you have trouble with?


    Christian
    --
    https://mail.python.org/mailman/listinfo/python-list




    --
    https://mail.python.org/mailman/listinfo/python-list



    --
    Bien à vous,
    --------------------- ------------------ ----------------- -------------------- -----------------
    Dioumacor FAYE doctorant au LPAOSF/ESP/UCAD/BP 5085 Dakar-Fann, Sénégal.
    Tel labo: (00221) 33 825 93 64
    Email: [email protected] <[email protected]> Tel: +221773475098 +221783484308
    Physicien en herbe
    Pseudo Skype: dioumacorfaye

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)