Skip to content

Appropriate workflow using psp_load #172

Description

@Sibghat46

Hi,
I have irfu-matlab version: v1.17.0 on MATLAB2025a in windows 11. MMS datastore and mms.get_data has been working great but recently I was trying to plot psp data with irfu functions, but I am experiencing multiple problems in order to follow the correct workflow.
I previously downloaded PSP (Fields and sweap) data using pyspedas (for the following time '2018-11-04T17:05:00Z/2018-11-04T17:07:00Z') and its stored in the following path,

C:\Users\sibgh\psp_data\fields\l2\mag_sc\2018

psp_fld_l2_mag_sc_2018110500_v02.cdf
psp_fld_l2_mag_sc_2018110506_v02.cdf
psp_fld_l2_mag_sc_2018110512_v02.cdf
psp_fld_l2_mag_sc_2018110518_v02.cdf

I am trying to plot this data in irfu-matlab but there seems to be a problem with how I have used psp.load!

global dateStart dateEnd


datastore('psp','datapath', fullfile('C:','Users','sibgh','psp_data'))


dateStart = [2018 11 04];
dateEnd   = [2018 11 04];


Tint = irf.tint('2018-11-04T17:05:00Z/2018-11-04T17:07:00Z');


mag_sc     = psp_load('mag_sc');            
spc_np     = psp_load('spc_np_moment');     
spc_vp_rtn = psp_load('spc_vp_moment_rtn'); 
dqf        = psp_load('spc_dqf');           


B     = mag_sc.tlim(Tint);   
np    = spc_np.tlim(Tint);   
vp    = spc_vp_rtn.tlim(Tint);
dqf_t = dqf.tlim(Tint);      


t_np  = double(np.time.epochUnix);    
t_vp  = double(vp.time.epochUnix);
t_dqf = double(dqf_t.time.epochUnix);
t_B   = double(B.time.epochUnix);

dqf_bad = dqf_t.data(:,2) ~= 0;          


mask_np = interp1(t_dqf, double(dqf_bad), t_np, 'nearest', 0) ~= 0;
np.data(mask_np,:) = NaN;                 


mask_vp = interp1(t_dqf, double(dqf_bad), t_vp, 'nearest', 0) ~= 0;
vp.data(mask_vp,:) = NaN;                 


np_on_B = np;                             
np_on_B.data = interp1(t_np, np.data, t_B, 'nearest', NaN);
np_on_B.time.epochUnix = t_B;             

vp_on_B = vp;
vp_on_B.data = interp1(t_vp, vp.data, t_B, 'nearest', NaN);
vp_on_B.time.epochUnix = t_B;


Bmag = B;
Bmag.data = sqrt(sum(B.data(:,1:3).^2,2)); 

B.abs = Bmag;

It gives me the following response, stating no files were found.

`>> DataPlot
If you have access to the latest PSP data
then from the matlab command line enter the PSP credentials.

datastore('psp','usernameSSL','xxx');
datastore('psp','passwordSSL','xxx');
[critical: psp_load/get_file_list(980)] No cdf files found for fileBaseName=psp_fld_l2_mag_SC
Shall I download Y-yes to all, y-yes? [Y/y/n/N] [Y]>`

For other variables like proton moments it gives similar response;

[critical: psp_load/get_file_list(980)] No cdf files found for fileBaseName=psp_swp_spc_l3i

Kindly point out the mistake and a possible correction in my workflow for loading the data from C:\Users\sibgh\psp_data\fields or C:\Users\sibgh\psp_data\sweap

Regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions