Skip to content

Commit

Permalink
Perform filtering and removing the rows having NaN's for the lat-lon …
Browse files Browse the repository at this point in the history
…values post concatenating the columns from l2b_hdf.

PiperOrigin-RevId: 474283175
  • Loading branch information
The Google Earth Engine Community Authors authored and copybara-github committed Sep 14, 2022
1 parent b58aae8 commit de3232a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2019 The Google Earth Engine Community Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Define environment.
language: node_js
node_js:
- 10

# The jobs defined here are run in parallel:
jobs:
include:
- script: cd tutorials && bash run-tests.sh
name: "Community Tutorials Tests"
- script: cd toolkits/landcover && bash run-tests.sh
name: "Landcover Toolkit Tests"
34 changes: 34 additions & 0 deletions .travis/require-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Copyright 2019 The Google Earth Engine Community Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Exit on error.
set -e

# Path to check for changes.
DIR="$1"

echo "Checking for changes in ${DIR} in commits ${TRAVIS_COMMIT_RANGE}"

# Changed files in this pull request in the specified dir.
CHANGES=`git diff --name-only ${TRAVIS_COMMIT_RANGE} ${DIR}`

# Fail if no changes, causing travis.yml to skip running tests.
if [ -z "$CHANGES" ]; then
echo "No changes in ${DIR}, skipping tests..."
exit 1
else
echo "Changed files:"
echo "${CHANGES}"
fi
11 changes: 5 additions & 6 deletions datasets/gedi_extract_l2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,18 @@ def write_csv(l2a_hdf_fh, l2b_hdf_fh, csv_file):
gedi_lib.hdf_to_df(l2a_hdf_fh, k, v, df)

rh = pd.DataFrame(l2a_hdf_fh[f'{k}/rh'], columns=rh_names)

df = pd.concat((df, rh), axis=1)
# Filter our rows with nan values for lat_lowestmode or lon_lowestmode.
# Such rows are not ingestable into EE.
df = df[df.lat_lowestmode.notnull()]
df = df[df.lon_lowestmode.notnull()]

gedi_lib.add_shot_number_breakdown(df)

# Add the incidence angle variables from the corresponding L2B file.
for l2b_var in l2b_variables:
gedi_lib.hdf_to_df(l2b_hdf_fh, k, 'geolocation/' + l2b_var, df)

# Filter our rows with nan values for lat_lowestmode or lon_lowestmode.
# Such rows are not ingestable into EE.
df = df[df.lat_lowestmode.notnull()]
df = df[df.lon_lowestmode.notnull()]

df.to_csv(
csv_file,
float_format='%3.6f',
Expand Down

0 comments on commit de3232a

Please sign in to comment.