Opened 11 years ago

Closed 8 years ago

#667 closed task (fixed)

Utility to associated a custom SWE data component to coverages

Reported by: Piero Campalani Owned by: Dimitar Misev
Priority: major Milestone: 9.3
Component: petascope Version: development
Keywords: swe creation script Cc: Dimitar Misev
Complexity: Medium

Description

While the Petascope partly supports SWE data components, there is still no user-friendly way (other than manual SQL inserts) to generate a custom SWE for the range type description of a coverage.

A simple shell script can/should be created to support users on the creation of such metadata.

Change History (12)

comment:1 by Dimitar Misev, 11 years ago

You mean this can be automatically derived from the existing tables in petascope? Why can't we do it in the petascope code in that case?

comment:2 by Piero Campalani, 11 years ago

I mean: now a user who wants to associate a custom SWE quantity to a coverage (rasimport does not provide params for this, e.g. UoM, NIL values and reasons, custom allowed intervals…), needs to manually INSERT/UPDATE the database.

I am talking about a script/tool that lets you set this thing for a coverage without interventions on the db.

Otoh, Petascope can already interpret custom SWE fields (see our eobstest coverage import function).

comment:3 by Dimitar Misev, 11 years ago

But this is the case for any other petascope metadata, not just SWE. It would be better to implement support for the SWE metadata in rasimport, rather than creating new scripts.

comment:4 by Piero Campalani, 11 years ago

Which other metadata do you mean?
I just proposed the bash-way now as a quicker solution: ideally rasgeo would need it, I agree, but Alex has worked already much on rasgeo lately, so we probably need somebody else for it.

comment:5 by Dimitar Misev, 10 years ago

Cc: Bidesh Thapaliya added

Can you point to the petascopedb documentation for the SWE? Then Bidesh could implement support for it in rasimport.

comment:6 by Piero Campalani, 10 years ago

SWE common data model:

  1. http://www.opengeospatial.org/standards/swecommon
  2. http://portal.opengeospatial.org/files/?artifact_id=41157

petascopedb:

  1. wiki:PetascopeDevGuide#Petascopedatabaseschema:petascopedb
  2. Feature space (range type) section of wiki:PetascopeDevGuide#Tablesandfields
  3. UML diagrams in browser:PetascopeDevGuide attachments

examples:

  1. see functions import_eobs(), import_irr_cube_2() in browser:systemtest/util/petascope.sh
  2. From http://earthserver.eu/trac/wiki/UseCase_EOX_SnowMapSeries (access required):
    [...]
    #
    # SWE quantity
    # (queries valid for PostgreSQL >= 9.1)
    #
    # UoM
    $PSQL -c "INSERT INTO ps_uom (code) SELECT '${c_swe_uom_code}' WHERE NOT EXISTS (SELECT id FROM ps_uom WHERE code='${c_swe_uom_code}')"
    uom_id=$( $PSQL -P t -P format=unaligned -c "SELECT id FROM ps_uom WHERE code='${c_swe_uom_code}'" )
    # NIL value
    $PSQL -c "INSERT INTO ps_nil_value (value, reason) SELECT '${c_swe_nil_value}', '${c_swe_nil_reason}' WHERE NOT EXISTS (SELECT id FROM ps_nil_value WHERE value='${c_swe_nil_value}' AND reason='${c_swe_nil_reason}')"
    nil_id=$( $PSQL -P t -P format=unaligned -c "SELECT id FROM ps_nil_value WHERE value='${c_swe_nil_value}' AND reason='${c_swe_nil_reason}'" )
    # data record
    $PSQL -c "INSERT INTO ps_quantity (uom_id, label, description, definition_uri, nil_ids) SELECT ${uom_id}, '${c_swe_label}', '${c_swe_description}', '${c_swe_definition_uri}', ARRAY[${nil_id}] WHERE NOT EXISTS (SELECT id FROM ps_quantity WHERE uom_id=${uom_id} AND label='${c_swe_label}' AND description='${c_swe_description}')"
    quantity_id=$( $PSQL -P t -P format=unaligned -c "SELECT id FROM ps_quantity WHERE uom_id='${uom_id}' AND label='${c_swe_label}' AND description='${c_swe_description}'" )
    # allowed values
    interval_id=$( $PSQL -P t -P format=unaligned -c "SELECT id FROM ps_interval WHERE min='${c_swe_min}' AND max='${c_swe_max}'" )
    $PSQL -c "INSERT INTO ps_quantity_interval (quantity_id, interval_id) SELECT ${quantity_id}, ${interval_id} WHERE NOT EXISTS (SELECT * FROM ps_quantity_interval WHERE quantity_id=${quantity_id} AND interval_id=${interval_id})"
    # link quantity to cryo coverage
    coverage_id=$( $PSQL -P t -P format=unaligned -c "SELECT id FROM ps_coverage WHERE name='${cov_name}'" )
    $PSQL -c "UPDATE ps_range_type_component SET field_id='${quantity_id}' WHERE coverage_id=${coverage_id}"
    

Support is needed for changing Quantity UoM, Quantity label and description, Quantity definition URI, Quantity allowed intervals and nil values (the significant figures are there but still not used by Petascope)(see also browser:applications/petascope/src/main/db/petascope/update8/schema.sql)

comment:7 by Dimitar Misev, 10 years ago

Owner: changed from Piero Campalani to Bidesh Thapaliya
Status: newassigned

Thanks, reassigning to Bidesh but it's a low priority ticket for now.

comment:8 by Dimitar Misev, 10 years ago

Milestone: 9.110.0

comment:9 by Dimitar Misev, 9 years ago

Owner: changed from Bidesh Thapaliya to Alex Dumitru

comment:10 by Bang Pham Huu, 8 years ago

Cc: Bidesh Thapaliya removed
Milestone: 10.09.3
Owner: changed from Alex Dumitru to Bang Pham Huu

I will look at this ticket soon.

in reply to:  2 comment:11 by Bang Pham Huu, 8 years ago

Cc: Dimitar Misev added
Owner: changed from Bang Pham Huu to Dimitar Misev

I think wcst_import support these parameters (UoM, NIL,…) and it can display with DescribeCoverage.

@dmisev: should you consider close this ticket?

Replying to pcampalani:

I mean: now a user who wants to associate a custom SWE quantity to a coverage (rasimport does not provide params for this, e.g. UoM, NIL values and reasons, custom allowed intervals…), needs to manually INSERT/UPDATE the database.

I am talking about a script/tool that lets you set this thing for a coverage without interventions on the db.

Otoh, Petascope can already interpret custom SWE fields (see our eobstest coverage import function).

comment:12 by Bang Pham Huu, 8 years ago

Resolution: fixed
Status: assignedclosed

I think can close ticket as it is supported in wcst_import.

Note: See TracTickets for help on using tickets.