Changeset 2349 in lmdz_wrf


Ignore:
Timestamp:
Feb 18, 2019, 8:30:27 PM (6 years ago)
Author:
lfita
Message:

Changing minor details in `compute_slices_stats_areaweighted':

  • Multiple slicing name separated by '-'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r2348 r2349  
    2866128661             dn, vu)
    2866228662            anewvar.setncattr('coordinates',' '.join(Spgrid[::-1]))
    28663             anewvar[:] = areas[0:Ngridsinmax,...]
    2866428663
    2866528664            aanewvar = onewnc.createVariable(dn+'area','f',tuple(Srgrid),            \
     
    2870028699                          gridsin[:,0:Ngridsin[j,i],j,i]
    2870128700                        pnewvar[0:Ngridsin[j,i],j,i]= percens[0:Ngridsin[j,i],j,i]
     28701                        anewvar[0:Ngridsin[j,i],j,i]= areas[0:Ngridsin[j,i],j,i]
    2870228702                        slicearea = 0.
    2870328703                        aa = 0.
     
    2870628706                            ix = gridsin[1,iv,j,i]
    2870728707                            iy = gridsin[0,iv,j,i]
    28708                             apolygon[:,0] = xdimvarbnds2D[:,iy,ix]
    28709                             apolygon[:,1] = ydimvarbnds2D[:,iy,ix]
    28710                             ag = np.abs(fsci.module_scientific.shoelace_area_polygon(nvertex=4, poly=apolygon))
    28711                             slicearea = slicearea + ag*percens[iv,j,i]
     28708#                            apolygon[:,0] = xdimvarbnds2D[:,iy,ix]
     28709#                            apolygon[:,1] = ydimvarbnds2D[:,iy,ix]
     28710#                            ag = np.abs(fsci.module_scientific.shoelace_area_polygon(nvertex=4, poly=apolygon))
     28711                            # Filtering zero areas?
     28712                            if areas[iv,j,i] == 0.:
     28713                                anewvar[iv,j,i] = 0.
     28714                                pnewvar[iv,j,i] = 0.
     28715                                areas[iv,j,i] = 0.
     28716                                percens[iv,j,i] = 0.
     28717
     28718                            slicearea = slicearea + areas[iv,j,i]*percens[iv,j,i]
    2871228719                            aa = aa + areas[iv,j,i]
    2871328720                            pp = pp + percens[iv,j,i]
     
    2873828745    Nnewslcs = len(newslcvarns)
    2873928746
    28740     dn = newslcvarns[0] + '_' + newslcvarns[1]
     28747    dn = newslcvarns[0] + '-' + newslcvarns[1]
    2874128748   
    2874228749    osliceNA = onewnc.variables[newslcvarns[0] + 'Ngrid']
     
    2888428891        islc == 2
    2888528892        prevdn = dn
    28886         dn = prevdn + '_' + newslcvarns[islc]
     28893        dn = prevdn + '-' + newslcvarns[islc]
    2888728894
    2888828895        osliceNAB = onewnc.variables[prevdn + 'Ngrid']
     
    2918329190    idd = 0
    2918429191    for dnn in Ndims:
    29185         scvv = slicesinf[dnn.split('_')[1]]
     29192        scvv = slicesinf[dnn.split('-')[1]]
    2918629193        sccvvv = scvv[3]
    2918729194        slicesvals.append(sccvvv[chijk[idd]])
Note: See TracChangeset for help on using the changeset viewer.