[..] La fonction [scl] fscan_ncscl

Code
int fscan_nc_xpl(){ scltracefa(§, ƒ, ); scltracefc("scl-%s (%s) : %s\n", sclver(), sclsec(), temps_char(0)); scltracefc(" < netcdf-%s\n\n", sclver_nc()); std::string ncfilename = "dt_global_allsat_phy_l4_20161130_20170530.nc"; std::string ncfilepath = "./don/netcdf/" + ncfilename; finfo_nc(ncfilepath.c_str()); //--------------------------------------------------------------------- //[>INPUT SURFACE] //--------------------------------------------------------------------- size_t sot; int dimn; void **nc = fscan_nc(ncfilepath.c_str(), "sla", &sot, &dimn); int *crdn=(int*)nc[0], latn=crdn[1], lonn=crdn[2], loni, lati; scltracefc("lonn=%d, latn=%d\n", lonn, latn); int ***sla = (int***)nc[1]; //[timn=1][latn=720][lonn=1440] int csla; double **sla_m = newmat<double>(lonn, latn); int **slac = newmat<int>(lonn, latn, 1); for(loni=0;loni<lonn;loni++){ for(lati=0;lati<latn;lati++){ csla = sla[0][lati][loni]; // Test de la valeur de remplissage '_FillValue' if(csla==-2147483647){ slac[loni][lati]=0; } // Mise a l'echelle 'scale_factor' sla_m[loni][lati] = (double)csla*0.000100; } } // Longitude [deg] nc = fscan_nc(ncfilepath.c_str(), "longitude", &sot, &dimn); float *lon=(float*)nc[1]; double *lon_deg=new double[lonn]; for(loni=0;loni<lonn;loni++){ lon_deg[loni]=(double)lon[loni]; } // Latitude [deg] nc = fscan_nc(ncfilepath.c_str(), "latitude", &sot, &dimn); float *lat=(float*)nc[1]; double *lat_deg=new double[latn]; for(lati=0;lati<latn;lati++){ lat_deg[lati]=(double)lat[lati]; } scl::string_c imgname=scl::string_c(ƒ)+".pdf", imgpath="./srt/"+imgname; grafmat_dis(imgpath.c_str(), lonn, latn, sla_m, "instatus", slac, "x", lon_deg, "y", lat_deg, "geographic", "flat", "colormap", "paruline", "subtitlex", imgname.c_str(), "zlabel", "[<zrange>] [m]", "title", "Seal Level Anomaly", "linespeca", "-a", ); #ifndef NON_SHQ_SCL tabx_t slax; slax.sot = sizeof(int); slax.dimn = 2; slax.crdn = new int[2]; slax.crdn[0]=lonn; slax.crdn[1]=latn; slax.crde = new int[2]; slax.crde[0]=lonn; slax.crde[1]=latn; slax.tabx = (void*)slac; std::string jsoname=std::string(ƒ)+".json", jsonpath="./srt/"+jsoname; shq::beginDrawing(/*jsonpath*/); // <Initializes the 🦅 "connection" shq::newFigure("fscan_nc"); // <Creates a new 🦅 figure; shq::Params prms = shq::Params("colormap","paruline"); prms["instatus"] = slax; shq::drawSurface(lonn, latn, sla_m, 0, 0, 1, 1, prms); shq::axisAuto(); shq::axisEqual("fscan_nc"); /*shq::setFigureProperties("drawline_shq", shaqParams("x",0,"y",220,"width",450,"height",100));*/ std::vector<std::string> labels; labels.push_back("[dim-1]"); labels.push_back("[dim-2]"); labels.push_back("[dim-3]"); shq::axisLabels(labels); shq::saveImage("./srt/fscan_nc.svg"); shq::endDrawing(); // <Closes the 🦅 "connection" #endif //--------------------------------------------------------------------- //[<INPUT SURFACE] //--------------------------------------------------------------------- //--------------------------------------------------------------------- //[>PROJECTION] //--------------------------------------------------------------------- double stlona_deg=min<double>(lonn, lon_deg), stlone_deg=max<double>(lonn, lon_deg); double stlata_deg=min<double>(latn, lat_deg), stlate_deg=max<double>(latn, lat_deg); // Global position number int stn = lonn*latn; double *stlonrad = new double[stn], *stlatrad = new double[stn]; maillkar(lonn, stlona_deg, stlone_deg, latn, stlata_deg, stlate_deg, 1, stlonrad, stlatrad); deg_rad(stn, stlonrad, stlonrad); deg_rad(stn, stlatrad, stlatrad); double *stxgdho = new double[stn], *stygdho = new double[stn]; int *stregion = new int[stn]; lls_gdho(stn, stlonrad, stlatrad, stxgdho, stygdho, stregion); //--------------------------------------------------------------------- //[<PROJECTION] //--------------------------------------------------------------------- //--------------------------------------------------------------------- //[>VIEW GRID] //--------------------------------------------------------------------- double dstn = (double)stn; double stxa_gdho = min<double>(stn, stxgdho); double stxe_gdho = max<double>(stn, stxgdho); double stya_gdho = min<double>(stn, stygdho); double stye_gdho = max<double>(stn, stygdho); // Projection point surface double stareagdho = (stxe_gdho-stxa_gdho)*(stye_gdho-stya_gdho); // View projection x point number int xn_gdho = (int)((dstn)*(stxe_gdho-stxa_gdho)/(stareagdho)); // View projection y point number int yn_gdho = (int)((dstn)*(stye_gdho-stya_gdho)/(stareagdho)); scltracefc("xgdhon=%d, ygdhon=%d\n", xn_gdho, yn_gdho); int gdhon = xn_gdho*yn_gdho, gdhoi; double *vwx_gdho=new double[gdhon], *vwy_gdho=new double[gdhon]; double *vwz_gdho=new double[gdhon]; maillkar(xn_gdho, stxa_gdho, stxe_gdho, yn_gdho, stya_gdho, stye_gdho, 1, vwx_gdho, vwy_gdho); scltracefc("stxa_gdho=%lf, stxe_gdho=%lf\n", stxa_gdho, stxe_gdho); scltracefc("stya_gdho=%lf, stye_gdho=%lf\n", stya_gdho, stye_gdho); double *vwlon=new double[gdhon], *vwlat=new double[gdhon]; int *vwin_gdho=new int[gdhon], *vwregion=new int[gdhon]; // Inverse projection gdho_lls(gdhon, vwx_gdho, vwy_gdho, vwlon, vwlat, vwregion); rad_deg(gdhon, vwlon, vwlon); rad_deg(gdhon, vwlat, vwlat); // Translation pour interpolation longitude dans 0-360 for (gdhoi=0;gdhoi<gdhon;gdhoi++){ if (vwlon[gdhoi]<0){ vwlon[gdhoi]+=360; } } gdhoi=0; scltracefc("vwlon[%d]=%lf, vwlat[%d]=%lf, vwregion[%d]=%d\n", gdhoi, vwlon[gdhoi], gdhoi, vwlat[gdhoi], gdhoi, vwregion[gdhoi]); //🔬 interpmat(lonn, latn, sla_m, slac, stlona_deg, stlone_deg, stlata_deg, stlate_deg, gdhon, vwlon, vwlat, vwz_gdho, , , vwin_gdho); // inverse projection instatus is added to interpolation instatus for (gdhoi=0;gdhoi<gdhon;gdhoi++){ if (vwregion[gdhoi]<=0){ vwin_gdho[gdhoi]=0; } } double **vwz = tab_mat<double>(xn_gdho, yn_gdho, vwz_gdho, 1); int **vwin = tab_mat<int>(xn_gdho, yn_gdho, vwin_gdho, 1); double *vwx = newtablin(xn_gdho, stxa_gdho, stxe_gdho); double *vwy = newtablin(yn_gdho, stya_gdho, stye_gdho); //--------------------------------------------------------------------- //[<VIEW GRID] //--------------------------------------------------------------------- //--------------------------------------------------------------------- //[>PLOT] //--------------------------------------------------------------------- imgname.clear(); imgname = scl::string_c(ƒ) + "-gdho.pdf"; imgpath.clear(); imgpath = "./srt/" + imgname; double cd=0; int regj; double vuxa = 20/180*π+scleps(); lls_gdho(1, &vuxa, &cd, &vuxa, &cd, &regj); double vuxe=-vuxa, vuxd=(vuxe-vuxa)/2*0.01; vuxa-=vuxd; vuxe+=vuxd; grafmat_dis(imgpath.c_str(), xn_gdho, yn_gdho, vwz, "instatus", vwin, "x", vwx, "y", vwy, "subtitlex", imgname.c_str(), "geographic", "gdho", "colormap", "paruline", "axis", "equal", "axis", "off", "zlabel", "[<zrange>] [m]", "title", "Seal Level Anomaly", "azmin", -0.944241, "axmin", vuxa, "axmax", vuxe, "linespeca", "-a", ); #ifndef NON_SHQ_SCL tabx_t vwix; vwix.sot = sizeof(int); vwix.dimn = 2; vwix.crdn = new int[2]; vwix.crdn[0]=xn_gdho; vwix.crdn[1]=yn_gdho; vwix.crde = new int[2]; vwix.crde[0]=xn_gdho; vwix.crde[1]=yn_gdho; vwix.tabx = (void*)vwin; shq::beginDrawing(/*jsonpath*/); // <Initializes the 🦅 "connection" shq::newFigure("fscan_nc-gdho"); // <Creates a new 🦅 figure; shq::Params prmg = shq::Params("colormap","paruline"); prmg["instatus"] = vwix; shq::drawSurface(xn_gdho, yn_gdho, vwz, 0, 0, 1, 1, prmg); shq::axisAuto(); shq::axisEqual("fscan_nc-gdho"); /*shq::setFigureProperties("drawline_shq", shaqParams("x",0,"y",220,"width",450,"height",100));*/ /*std::vector<std::string> labels; labels.push_back("[dim-1]"); labels.push_back("[dim-2]"); labels.push_back("[dim-3]");*/ shq::axisLabels(labels); shq::saveImage("./srt/fscan_nc-gdho.svg"); shq::endDrawing(); // <Closes the 🦅 "connection" #endif //--------------------------------------------------------------------- //[<PLOT] //--------------------------------------------------------------------- //--------------------------------------------------------------------- //[>LIBERE MEMOIRE] //--------------------------------------------------------------------- delete[] lon_deg; lon_deg=; delete[] lat_deg; lat_deg=; deletemat<double>(lonn, &sla_m); delete[] stlonrad; stlonrad=; delete[] stlatrad; stlatrad=; delete[] stxgdho; stxgdho=; delete[] stygdho; stygdho=; delete[] vwx_gdho; vwx_gdho=; delete[] vwy_gdho; vwy_gdho=; delete[] vwz_gdho; vwz_gdho=; delete[] vwlon; vwlon=; delete[] vwlat; vwlat=; delete[] vwregion; vwregion=; delete[] vwin_gdho; vwin_gdho=; deletemat<double>(xn_gdho, &vwz); deletemat<int>(xn_gdho, &vwin); delete[] vwx; vwx=; delete[] vwy; vwy=; imgname.clear(); imgpath.clear(); //--------------------------------------------------------------------- //[<LIBERE MEMOIRE] //--------------------------------------------------------------------- scltracefe(§, ƒ, ); return 0; } /* ƒ décorée par 🔬 le 22-03-2025 21:25:14 */
Sortie
[>..\xpl\src\sclhdf.nc.xpl.cpp.fscan_nc_xpl] scl-25.03 (gwin64) : 22-03-2025 21:25:14 < netcdf-4.4.1.1 of Aug 6 2019 08:13:58 $ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [>NETCDF FILE INFORMATIONS] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> OS benchmark: - sizeof(double)=8 - sizeof(float) =4 - sizeof(int) =4 - sizeof(long) =4 filepath : './don/netcdf/dt_global_allsat_phy_l4_20161130_20170530.nc' - varn=14 - format=NC_FORMAT_CLASSIC - variable : 'crs' - type=NC_INT - dimn=0 - attn=4 - attribut 'comment' - type=NC_CHAR - 'This is a container variable that describes the grid_mapping used by the data in this file. This variable does not contain any data; only information about the geographic coordinate system.' - attribut 'grid_mapping_name' - type=NC_CHAR - 'latitude_longitude' - attribut 'inverse_flattening' - type=NC_DOUBLE - value=298.257000 - attribut 'semi_major_axis' - type=NC_DOUBLE - value=6378136.300000 - variable : 'time' - type=NC_FLOAT - dimn=1 { 'time' (x1) } - attn=5 - attribut 'axis' - type=NC_CHAR - 'T' - attribut 'calendar' - type=NC_CHAR - 'gregorian' - attribut 'long_name' - type=NC_CHAR - 'Time' - attribut 'standard_name' - type=NC_CHAR - 'time' - attribut 'units' - type=NC_CHAR - 'days since 1950-01-01 00:00:00' - variable : 'latitude' - type=NC_FLOAT - dimn=1 { 'latitude' (x720) } - attn=7 - attribut 'axis' - type=NC_CHAR - 'Y' - attribut 'bounds' - type=NC_CHAR - 'lat_bnds' - attribut 'long_name' - type=NC_CHAR - 'Latitude' - attribut 'standard_name' - type=NC_CHAR - 'latitude' - attribut 'units' - type=NC_CHAR - 'degrees_north' - attribut 'valid_max' - type=NC_DOUBLE - value=89.875000 - attribut 'valid_min' - type=NC_DOUBLE - value=-89.875000 - variable : 'lat_bnds' - type=NC_FLOAT - dimn=2 { 'latitude' (x720), 'nv' (x2) } - attn=2 - attribut 'comment' - type=NC_CHAR - 'latitude values at the north and south bounds of each pixel.' - attribut 'units' - type=NC_CHAR - 'degrees_north' - variable : 'longitude' - type=NC_FLOAT - dimn=1 { 'longitude' (x1440) } - attn=7 - attribut 'axis' - type=NC_CHAR - 'X' - attribut 'bounds' - type=NC_CHAR - 'lon_bnds' - attribut 'long_name' - type=NC_CHAR - 'Longitude' - attribut 'standard_name' - type=NC_CHAR - 'longitude' - attribut 'units' - type=NC_CHAR - 'degrees_east' - attribut 'valid_max' - type=NC_DOUBLE - value=359.875000 - attribut 'valid_min' - type=NC_DOUBLE - value=0.125000 - variable : 'lon_bnds' - type=NC_FLOAT - dimn=2 { 'longitude' (x1440), 'nv' (x2) } - attn=2 - attribut 'comment' - type=NC_CHAR - 'longitude values at the west and east bounds of each pixel.' - attribut 'units' - type=NC_CHAR - 'degrees_east' - variable : 'nv' - type=NC_INT - dimn=1 { 'nv' (x2) } - attn=2 - attribut 'comment' - type=NC_CHAR - 'Vertex' - attribut 'units' - type=NC_CHAR - '1' - variable : 'ugos' - type=NC_INT - dimn=3 { 'time' (x1), 'latitude' (x720), 'longitude' (x1440) } - attn=7 - attribut '_FillValue' - type=NC_INT - value=-2147483647 - attribut 'coordinates' - type=NC_CHAR - 'longitude latitude' - attribut 'grid_mapping' - type=NC_CHAR - 'crs' - attribut 'long_name' - type=NC_CHAR - 'Absolute geostrophic velocity: zonal component' - attribut 'scale_factor' - type=NC_DOUBLE - value=0.000100 - attribut 'standard_name' - type=NC_CHAR - 'surface_geostrophic_eastward_sea_water_velocity' - attribut 'units' - type=NC_CHAR - 'm/s' - variable : 'vgosa' - type=NC_INT - dimn=3 { 'time' (x1), 'latitude' (x720), 'longitude' (x1440) } - attn=8 - attribut '_FillValue' - type=NC_INT - value=-2147483647 - attribut 'comment' - type=NC_CHAR - 'The geostrophic velocity anomalies are referenced to the [1993, 2012] period' - attribut 'coordinates' - type=NC_CHAR - 'longitude latitude' - attribut 'grid_mapping' - type=NC_CHAR - 'crs' - attribut 'long_name' - type=NC_CHAR - 'Geostrophic velocity anomalies: meridian component' - attribut 'scale_factor' - type=NC_DOUBLE - value=0.000100 - attribut 'standard_name' - type=NC_CHAR - 'surface_geostrophic_northward_sea_water_velocity_assuming_sea_level_for_geoid' - attribut 'units' - type=NC_CHAR - 'm/s' - variable : 'vgos' - type=NC_INT - dimn=3 { 'time' (x1), 'latitude' (x720), 'longitude' (x1440) } - attn=7 - attribut '_FillValue' - type=NC_INT - value=-2147483647 - attribut 'coordinates' - type=NC_CHAR - 'longitude latitude' - attribut 'grid_mapping' - type=NC_CHAR - 'crs' - attribut 'long_name' - type=NC_CHAR - 'Absolute geostrophic velocity: meridian component' - attribut 'scale_factor' - type=NC_DOUBLE - value=0.000100 - attribut 'standard_name' - type=NC_CHAR - 'surface_geostrophic_northward_sea_water_velocity' - attribut 'units' - type=NC_CHAR - 'm/s' - variable : 'ugosa' - type=NC_INT - dimn=3 { 'time' (x1), 'latitude' (x720), 'longitude' (x1440) } - attn=8 - attribut '_FillValue' - type=NC_INT - value=-2147483647 - attribut 'comment' - type=NC_CHAR - 'The geostrophic velocity anomalies are referenced to the [1993, 2012] period' - attribut 'coordinates' - type=NC_CHAR - 'longitude latitude' - attribut 'grid_mapping' - type=NC_CHAR - 'crs' - attribut 'long_name' - type=NC_CHAR - 'Geostrophic velocity anomalies: zonal component' - attribut 'scale_factor' - type=NC_DOUBLE - value=0.000100 - attribut 'standard_name' - type=NC_CHAR - 'surface_geostrophic_eastward_sea_water_velocity_assuming_sea_level_for_geoid' - attribut 'units' - type=NC_CHAR - 'm/s' - variable : 'adt' - type=NC_INT - dimn=3 { 'time' (x1), 'latitude' (x720), 'longitude' (x1440) } - attn=8 - attribut '_FillValue' - type=NC_INT - value=-2147483647 - attribut 'comment' - type=NC_CHAR - 'The absolute dynamic topography is the sea surface height above geoid; the adt is obtained as follows: adt=sla+mdt where mdt is the mean dynamic topography; see the product user manual for details' - attribut 'coordinates' - type=NC_CHAR - 'longitude latitude' - attribut 'grid_mapping' - type=NC_CHAR - 'crs' - attribut 'long_name' - type=NC_CHAR - 'Absolute dynamic topography' - attribut 'scale_factor' - type=NC_DOUBLE - value=0.000100 - attribut 'standard_name' - type=NC_CHAR - 'sea_surface_height_above_geoid' - attribut 'units' - type=NC_CHAR - 'm' - variable : 'sla' - type=NC_INT - dimn=3 { 'time' (x1), 'latitude' (x720), 'longitude' (x1440) } - attn=8 - attribut '_FillValue' - type=NC_INT - value=-2147483647 - attribut 'comment' - type=NC_CHAR - 'The sea level anomaly is the sea surface height above mean sea surface; it is referenced to the [1993, 2012] period; see the product user manual for details' - attribut 'coordinates' - type=NC_CHAR - 'longitude latitude' - attribut 'grid_mapping' - type=NC_CHAR - 'crs' - attribut 'long_name' - type=NC_CHAR - 'Sea level anomaly' - attribut 'scale_factor' - type=NC_DOUBLE - value=0.000100 - attribut 'standard_name' - type=NC_CHAR - 'sea_surface_height_above_sea_level' - attribut 'units' - type=NC_CHAR - 'm' - variable : 'err' - type=NC_INT - dimn=3 { 'time' (x1), 'latitude' (x720), 'longitude' (x1440) } - attn=7 - attribut '_FillValue' - type=NC_INT - value=-2147483647 - attribut 'comment' - type=NC_CHAR - 'The formal mapping error represents a purely theoretical mapping error. It mainly traduces errors induced by the constellation sampling capability and consistency with the spatial/temporal scales considered, as described in Le Traon et al (1998) or Ducet et al (2000)' - attribut 'coordinates' - type=NC_CHAR - 'longitude latitude' - attribut 'grid_mapping' - type=NC_CHAR - 'crs' - attribut 'long_name' - type=NC_CHAR - 'Formal mapping error' - attribut 'scale_factor' - type=NC_DOUBLE - value=0.000100 - attribut 'units' - type=NC_CHAR - 'm' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [<NETCDF FILE INFORMATIONS] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< lonn=1440, latn=720 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< << END OF DISLIN / VERSION 11.3.2 << << Date : 22.03.2025 Time : 21:25:18 Pageformat: DA4L << << Vectors : 1558658 Warnings: 0 Fileformat: PDF << << Metafile: ./srt/fscan_nc_xpl.pdf << <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< xgdhon=1546, ygdhon=670 stxa_gdho=-20001204.415315, stxe_gdho=20001204.415315 stya_gdho=-8672133.369058, stye_gdho=8672133.369058 vwlon[0]=146.055639, vwlat[0]=1.#QNAN0, vwregion[0]=0 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< << END OF DISLIN / VERSION 11.3.2 << << Date : 22.03.2025 Time : 21:25:22 Pageformat: DA4L << << Vectors : 30826 Warnings: 0 Fileformat: PDF << << Metafile: ./srt/fscan_nc_xpl-gdho.pdf << <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [<..\xpl\src\sclhdf.nc.xpl.cpp.fscan_nc_xpl]