def header_file_model_code(modelname, dyear,c_cofs,s_cofs,c_secvars,s_secvars):
    """return the code defining the WMM coefficents and model
                Stored in a ConstModel, index=((2*maxdegree-m+1)*m)/2+n
                    typedef struct {
                            const float epoch;
                            const float Main_Field_Coeff_C[NUMCOF];
                            const float Main_Field_Coeff_S[NUMCOF];
                            const float Secular_Var_Coeff_C[NUMCOF];
                            const float Secular_Var_Coeff_S[NUMCOF];
                    } ConstModel;

    Args:
        modelname(str, a valid C++ name): name of the model
        dyear(positive float): the year of the magnetic model, ex 2015.0
        c_cofs,s_cofs,c_secvars,s_secvars(list of floats): coefficents of the model"""

    head="""constexpr
#ifdef PROGMEM
    PROGMEM
#endif /* PROGMEM */
ConstModel %s = {%f,\n"""%(modelname,dyear)
    modeltail= '};\n\n'
    cs='{'
    ss='{'
    csec='{'
    ssec='{'
    for i in range(len(c_cofs)):
        cs+= repr(c_cofs[i])+','
        ss+= repr(s_cofs[i])+','
        csec+= repr(c_secvars[i])+','
        ssec+= repr(s_secvars[i])+','
    cs= cs[:-1]+'}'
    ss= ss[:-1]+'}'
    csec= csec[:-1]+'}'
    ssec= ssec[:-1]+'}'
    return head+cs+',\n'+ss+',\n'+csec+',\n'+ssec+modeltail