Hi Rodrigo,
Try changing the "compress" value to 4, instead of 1. If you were using
integer values, 1 would work fine, but since you're using floating-point
values, you'll need to use the extra space.
Also, for efficiency reasons, don't calculate the same thing over and
over in your "for" loops:
change this
for(i=0;i<nr*nc*maxnl;i++)
{
/* loop contents */
}
to something like this
int num = nr*nc*maxnl;
for(i=0;i<num;i++)
{
/* loop contents */
}
See if that helps.
Dan McCormick
Rodrigo Andrade de Bem wrote:
> Hi all,
>
> I was really wondering if someone could help me. I am trying to write
> a 3D cube grid with any dimension (e.g. 3x3x3, 10x10x10, ...) without
> any physical mean, filled with probabilistic values (real values
> between 0 and 1). The grid coordinates are discrete, so I could have
> something like grid[1][1][1]=0.5, or grid[2][1][0]=0.3, etc. The grid
> values can
> change along the time, so I can have many time steps. However the date
> and the time stamps meanings are no important to me. The timestamp
> only means a step along the time, but the time interval between each
> step is not important.
>
> Now I had done a very simple program, as simple as I could following
> the vis5d manual, just to write a sample 3D grid and fill it entirely
> with 0.5 values, but it is not working properly. The problem is that
> the minimum value of the data is corrupted, as can be seen in the
> v5dinfo result. Because this I am having problems in the
> visualization, the isosurface threshold, for example, it is not
> working well. I might be a silly problem, but unfortunately I am not
> being
> able to find it. I was wondering if someone could give a quick glance
> in my program
> (it is commented and has only 100 lines). I am also sending the
> infov5d result below and the .v5d file that I generated with this
> program. The command line I used to compile was gcc test_out.c -o
> test_out -lv5d.
>
> Maybe if someone could also send me a sample writing program in C that
> you had
> done, it would be helpful for me.
>
> Thank you very much in advance, I was wondering if someone could help me,
> because I am wasting so much time if this problem without success.
>
> Best regards,
> Rodrigo.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
> bash-3.1$ v5dinfo output.v5d
> File format: v5d version: 4.3
> Compression: 1 byte per gridpoint.
> header size=11224
> sizeof(v5dstruct)=334068
>
> NumVars = 1
> Var Name Units Rows Cols Levels LowLev MinVal MaxVal
> 1 VAR1 3 3 3 0 2.65199e-39 0.5
>
> NumTimes = 5
> Step Date(YYYYDDD) Time(HH:MM:SS) Day
> 1 0 0:00:00 Friday
> 2 0 0:00:01 Friday
> 3 0 0:00:02 Friday
> 4 0 0:00:03 Friday
> 5 0 0:00:04 Friday
>
> Generic linear vertical coordinate system:
> Bottom Bound: 0.000000
> Increment between levels: 1.000000
>
> Generic linear projection:
> North Boundary: 0.000000
> West Boundary: 0.000000
> Row Increment: 1.000000
> Column Increment: 1.000000
>
>
> On 6/4/07, Steve Guimond <guimond@...> wrote:
>
>> Hi Rodrigo,
>> Sorry for not responding sooner. I took a quick glance at your
>> file and
>> several things seemed messed up. (1) Min and Max values are
>> missing, (2)
>> time steps are not set up correctly (unless you have a time step of 1
>> second), etc.
>> I think you were trying to set up a ratio axis from 0 to 1, but the
>> coordinate system you have specified in your file would indicate only
>> two
>> levels (0 and 1). You need to set the increment between levels to be
>> (1/#
>> of levels). As of right now it is set to 1.0 which would mean only 1
>> level in the vertical plus the bottom boundary for a total of 2.
>> Go through your program to make sure these are changed and then
>> re-make
>> the file. If you are still having trouble, just send me the raw data
>> and
>> I can take a look.
>>
>> Steve
>>
>>
>> =======================================================
>> Stephen R. Guimond
>> Graduate Research Assistant
>> Center for Ocean-Atmospheric Prediction Studies (COAPS)
>> =======================================================
>>
>> On Fri, 25 May 2007, Rodrigo Andrade de Bem wrote:
>>
>> > Hi,
>> > I think you didn't receive the file. I am sending to you in private. I
>> > had tested the the sample datasets and it is working, I mean, I can
>> > see the data plotted.
>> >
>> > Thanks you for any help!
>> >
>> > Rodrigo.
>> >
>> > On 5/24/07, Stephen R. Guimond <sguimond@...> wrote:
>> > > Hi,
>> > > Your data file never attached in the e-mail. Have you tried
>> the test
>> > > datasets included with the software to see if you can view anything?
>> > >
>> > >
>> > > Steve
>> > >
>> > >
>> > > > Send Vis5dplus mailing list submissions to
>> > > > vis5dplus@...
>> > > >
>> > > > To subscribe or unsubscribe via the World Wide Web, visit
>> > > > http://mailman.ucar.edu/mailman/listinfo/vis5dplus
>> > > > or, via email, send a message with subject or body 'help' to
>> > > > vis5dplus-request@...
>> > > >
>> > > > You can reach the person managing the list at
>> > > > vis5dplus-owner@...
>> > > >
>> > > > When replying, please edit your Subject line so it is more
>> specific
>> > > > than "Re: Contents of Vis5dplus digest..."
>> > > >
>> > > >
>> > > > Today's Topics:
>> > > >
>> > > > 1. Vis5d operation doubt (Rodrigo Andrade de Bem)
>> > > >
>> > > >
>> > > >
>> ----------------------------------------------------------------------
>> > > >
>> > > > Message: 1
>> > > > Date: Thu, 24 May 2007 13:44:01 +0200
>> > > > From: "Rodrigo Andrade de Bem" <rodrigo.bem@...>
>> > > > Subject: [Vis5dplus] Vis5d operation doubt
>> > > > To: vis5d-users@..., vis5dplus@...
>> > > > Message-ID:
>> > > >
>> <c3fd4db30705240444i27bffe19w89338284c51d4540@...>
>> > > > Content-Type: text/plain; charset="iso-8859-1"
>> > > >
>> > > > Hi all,
>> > > >
>> > > > I am saving a vis5d+ data file in my program, and trying to
>> read it in
>> > > > the vis5d+ software. The files seems correct, and I am able to
>> read
>> > > > it, but unfortunately I can't see the data. I had tried to
>> change the
>> > > > visualization modes, but without success. As I am still
>> learning how
>> > > > to use the Vis5d+ software, and I am in doubt if I am having a
>> problem
>> > > > with me data file, or a problem with the visualization modes in
>> the
>> > > > software.
>> > > >
>> > > > I am sending my data file, and if someone could test it to me, and
>> > > > give me some tip about what I am doing wrong, would be very
>> helpful.
>> > > >
>> > > > Thank you very much in advance for any help.
>> > > >
>> > > > Best regards,
>> > > > Rodrigo.
>> > > > -------------- next part --------------
>> > > > A non-text attachment was scrubbed...
>> > > > Name: test_data.v5d
>> > > > Type: application/octet-stream
>> > > > Size: 1324504 bytes
>> > > > Desc: not available
>> > > > Url :
>> > > >
>> http://mailman.ucar.edu/pipermail/vis5dplus/attachments/20070524/9423fea0/test_data.obj
>>
>> > > >
>> > > > ------------------------------
>> > > >
>> > > > _______________________________________________
>> > > > Vis5dplus mailing list
>> > > > Vis5dplus@...
>> > > > http://mailman.ucar.edu/mailman/listinfo/vis5dplus
>> > > >
>> > > >
>> > > > End of Vis5dplus Digest, Vol 24, Issue 1
>> > > > ****************************************
>> > > >
>> > >
>> > >
>> > > ========================================
>> > >
>> > >
>> >
>> >
>> >
>>
>>
>>
>------------------------------------------------------------------------
>
>#include<stdio.h>
>#include<stdlib.h>
>#include<string.h>
>#include<vis5d+/v5d.h>
>
>int main(void){
>
> /* declaration */
> char name[11], varname[MAXVARS][10]; /* !!name format!! */
> int numtimes, numvars, nr, nc, nl[MAXLEVELS], timestamp[MAXTIMES],
> datestamp[MAXTIMES], compress, projection, vertical; /* !! nl, timestamp, datestamp format !!*/
> float proj_args[100], vert_args[MAXLEVELS], *g;
> int i, maxnl, lowlev[MAXVARS];
>
> /* initialization */
> strcpy(name, "output.v5d");
> numtimes=5;
> numvars=1;
> nr=3;
> nc=3;
> for(i=0; i<numvars; i++)
> nl[i]=3; /*!! format !!*/
> for(i=0; i<numvars; i++)
> strcpy(varname[i],"VAR1");
>
> for(i=0; i<numtimes; i++) { /* !! be sure about this formats !! */
> timestamp[i]=i;
> datestamp[i]=0;
> }
>
> compress=1;
> projection=0;
> proj_args[0]=0; proj_args[1]=0; proj_args[2]=1; proj_args[3]=1;
> vertical=0;
> vert_args[0]=0; vert_args[1]=1;
>
> /* parmeters verification */
> printf("\n");
> printf("name: %s\n", name);
> printf("numtimes: %d\n", numtimes);
> printf("numvars: %d\n", numvars);
> printf("nr: %d\n", nr);
> printf("nc: %d\n", nc);
> for(i=0; i<numvars; i++)
> printf("nl[%d]: %d\n", i, nl[i]);
> for(i=0; i<numvars; i++)
> printf("varname[%d]: %s\n", i, varname[i]);
>
> for(i=0; i<numtimes; i++){
> printf("timestamp[%d]: %d\n", i, timestamp[i]);
> printf("datestamp[%d]: %d\n", i, datestamp[i]);
> }
> printf("compress: %d\n", compress);
> printf("projection: %d\n", projection);
> for(i=0; i<4; i++)
> printf("proj_args[%d]: %f\n", i, proj_args[i]);
>
> printf("vertical: %d\n", vertical);
> for(i=0; i<2; i++)
> printf("vert_args[%d]: %f\n", i, vert_args[i]);
>
> printf("\n");
>
>
> /* v5d file creation */
> v5dCreate( name, numtimes, numvars, nr, nc,
> nl, varname, timestamp, datestamp,
> compress, projection, proj_args,
> vertical, vert_args );
>
> for(i=0; i<numvars;i++)
> lowlev[i]=0;
> v5dSetLowLev(lowlev);
>
> /* writing */
> maxnl=nl[0]; /* all variable have the same number of levels */
>
> g = (float *) malloc( nr * nc * maxnl * sizeof(float) );
> if (!g) {
> printf("Error: out of memory\n");
> exit(1);
> }
>
> for(i=0;i<nr*nc*maxnl;i++)
> g[i]=0.5;
>
> for(i=1; i<=numtimes;i++)
> if (!v5dWrite( i, 1, g )) {
> printf("Error while writing grid. Disk full?\n");
> exit(1);
> }
>
> /* showing the data set */
> for(i=0;i<nr*nc*maxnl;i++)
> printf("g[%d]=%f\n", i, g[i]);
>
> /* closing */
> v5dClose();
>
> return 0;
>}
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Vis5dplus mailing list
>Vis5dplus@...
>http://mailman.ucar.edu/mailman/listinfo/vis5dplus
>
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.472 / Virus Database: 269.8.9/834 - Release Date: 6/5/2007 2:38 PM
>
>
|