Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[oe_configure_layer] 'timeElements' is not defined #82

Closed
PacoDu opened this issue Jul 3, 2018 · 0 comments · Fixed by #83
Closed

[oe_configure_layer] 'timeElements' is not defined #82

PacoDu opened this issue Jul 3, 2018 · 0 comments · Fixed by #83

Comments

@PacoDu
Copy link
Contributor

PacoDu commented Jul 3, 2018

I'm trying to generate a vector layer with oe_vectorgen, the generation from geojson to shapefile with oe_vectorgen is going well but once i'm trying to configure the layer with oe_configure_layer it results in an error:

Traceback (most recent call last):
  File "/usr/bin/oe_configure_layer", line 2439, in <module>
    if not static and len(timeElements)>0:
NameError: name 'timeElements' is not defined

I've took a quick look to oe_configure_layer script and it seems that in my case timeElements is never initialized when reaching this line:

if not static and len(timeElements)>0:
defaultDate = ''
timeExtent = ''
for timeElement in timeElements:
defaultDate = timeElement.firstChild.data.strip().split('/')[1]
timeExtent = timeExtent + timeElement.firstChild.data.strip() + ","
mapfile.write("\t\t\"wms_timeextent\"\t\t\"" + timeExtent.rstrip(',') + "\"\n")
mapfile.write("\t\t\"wms_timedefault\"\t\t\"" + defaultDate + "\"\n")

I noticed that timeElements is not initialized when time is handled for vector layer and this layer is not static:


This block is not executed for vector layer due to L1647 :
if static == False:
timeElements = []
for time in times:
detected_times = detect_time(time, archiveLocation, fileNamePrefix, year, has_zdb)
for detected_time in detected_times:
timeElements.append(mrf_dom.createElement('Time'))
timeElements[-1].appendChild(mrf_dom.createTextNode(detected_time))
for timeElement in timeElements:
twms.appendChild(timeElement)

else: # Vectors
has_zdb = False
detected_times = []
if static == False:
for time in times:
detected_times = detect_time(time, archiveLocation, fileNamePrefix, year, has_zdb)

This is my layer config file:

<LayerConfiguration>
 <Identifier>test1</Identifier>
 <Title>test1</Title>
 <FileNamePrefix>test1</FileNamePrefix>
 <Projection>EPSG:4326</Projection>
 <EnvironmentConfig>/etc/onearth/config/conf/environment_geographic.xml</EnvironmentConfig>
 <ArchiveLocation static="False" year="True" subdaily="True">/usr/share/onearth/shapefiles/test1</ArchiveLocation>
 <VectorType>POINT</VectorType>
 <VectorStyleFile>/usr/share/onearth/styles/test1.txt</VectorStyleFile>
 <Time>DETECT/PT15M</Time>
</LayerConfiguration>

test1 layer is a set of 25 points transformed into a shapefile and placed in a directory under shapefiles>test1>2016>test1TTTTTTTTTTTTT_.*

This is the mrfgen configuration used:

<?xml version="1.0" encoding="UTF-8"?>
<vectorgen_configuration>
 <date_of_data>20160419</date_of_data>
 <time_of_data>120000</time_of_data>
 <parameter_name>test1</parameter_name>
 <input_dir>source_files</input_dir>
 <output_dir>output_dir</output_dir>
 <working_dir>working_dir</working_dir>
 <logfile_dir>logfile_dir</logfile_dir>
 <output_name>{$parameter_name}%Y%j%H%M%S_</output_name>
 <output_format>ESRI Shapefile</output_format>
 <target_epsg>4326</target_epsg>
</vectorgen_configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant