[GRASS-dev] [GRASS GIS] #3068: Raise a warning/error when where parameter is not correctly set

#3068: Raise a warning/error when where parameter is not correctly set
-------------------------+-------------------------
Reporter: veroandreo | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Temporal | Version: svn-trunk
Keywords: where | CPU: Unspecified
Platform: Linux |
-------------------------+-------------------------
I have a set of 16 years of MODIS data starting on February 18, 2000. My
intention was to aggregate data seasonally (3 months granularity), but as
start is shifted, I wanted aggregation to start from April 1st. This was
my command:

{{{
t.rast.aggregate --o input=${var}_${tile} method=average \
output=${var}_${tile}_seasonal_average \
basename=${var}_${tile}_seasonal_average \
suffix=gran where="start_time >= 2000-04-01 00:00:00" \
granularity="3 months"
}}}

I forgot to write 'single quotes' around the date. Therefore, the where
parameter was ignored and all my seasons shifted and I had to
run all over again.

Would that be possible to check if the where clause is "well-written" and
raise an error/warning if it is not??

Thanks so much in advance!

ps: I guess I will double check for single quotes tons of times from now
on

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3068&gt;
GRASS GIS <https://grass.osgeo.org>

#3068: Raise a warning/error when where parameter is not correctly set
--------------------------+-------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.3.0
Component: Temporal | Version: svn-trunk
Resolution: | Keywords: where
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------

Comment (by mlennert):

Replying to [ticket:3068 veroandreo]:
> I have a set of 16 years of MODIS data starting on February 18, 2000. My
intention was to aggregate data seasonally (3 months granularity), but as
start is shifted, I wanted aggregation to start from April 1st. This was
my command:
>
> {{{
> t.rast.aggregate --o input=${var}_${tile} method=average \
> output=${var}_${tile}_seasonal_average \
> basename=${var}_${tile}_seasonal_average \
> suffix=gran where="start_time >= 2000-04-01 00:00:00" \
> granularity="3 months"
> }}}
>
> I forgot to write 'single quotes' around the date. Therefore, the where
parameter was ignored and all my seasons shifted and I had to
> run all over again.
>
> Would that be possible to check if the where clause is "well-written"
and raise an error/warning if it is not??

The problem will be to define "well-written". AFAIK, the "check" is
currently done by the db backend: if it accepts the formulation, then ok,
if not, you'll see an error.

So apparently your backend considers your where clause as being correct in
terms of syntax. And we won't be able to create and intelligent system
that will be able to tell whether what you write is actually what you
mean... :wink:

So, for me, this is a wonfix.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3068#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3068: Raise a warning/error when where parameter is not correctly set
--------------------------+-------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.3.0
Component: Temporal | Version: svn-trunk
Resolution: | Keywords: where
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------

Comment (by veroandreo):

Replying to [comment:1 mlennert]:
> Replying to [ticket:3068 veroandreo]:
> > I have a set of 16 years of MODIS data starting on February 18, 2000.
My intention was to aggregate data seasonally (3 months granularity), but
as start is shifted, I wanted aggregation to start from April 1st. This
was my command:
> >
> > {{{
> > t.rast.aggregate --o input=${var}_${tile} method=average \
> > output=${var}_${tile}_seasonal_average \
> > basename=${var}_${tile}_seasonal_average \
> > suffix=gran where="start_time >= 2000-04-01 00:00:00" \
> > granularity="3 months"
> > }}}
> >
> > I forgot to write 'single quotes' around the date. Therefore, the
where parameter was ignored and all my seasons shifted and I had to
> > run all over again.
> >
> > Would that be possible to check if the where clause is "well-written"
and raise an error/warning if it is not??
>
> The problem will be to define "well-written". AFAIK, the "check" is
currently done by the db backend: if it accepts the formulation, then ok,
if not, you'll see an error.

I see... but according to the definition in the manual, this where is in
the temporal framework, so I imagined it could be something like if
there's start_date or end_date in the left hand side, then check for
single quotes around the right hand part of the expression... maybe too
complicated...

> So apparently your backend considers your where clause as being correct
in terms of syntax.

So, it is an SQLite issue, that is not sensitive to that kind of mistakes?

> And we won't be able to create and intelligent system that will be able
to tell whether what you write is actually what you mean... :wink:

meep! :slight_smile:

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3068#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3068: Raise a warning/error when where parameter is not correctly set
--------------------------+-------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: enhancement | Status: closed
  Priority: normal | Milestone: 7.4.1
Component: Temporal | Version: svn-trunk
Resolution: wontfix | Keywords: where
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Changes (by veroandreo):

* status: new => closed
* resolution: => wontfix

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3068#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>