Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-api-local
Commits
907aeaca
Commit
907aeaca
authored
Jan 25, 2024
by
Wei Shoulin
Browse files
PI
parent
13703726
Pipeline
#3218
passed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api_local/facility/level1.py
View file @
907aeaca
...
@@ -8,6 +8,7 @@ from ..common.utils import *
...
@@ -8,6 +8,7 @@ from ..common.utils import *
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models.ifs
import
Level1Record
from
csst_dfs_commons.models.ifs
import
Level1Record
from
csst_dfs_commons.models.common
import
from_dict_list
from
csst_dfs_commons.models.common
import
from_dict_list
from
csst_dfs_commons.models.models
import
constants
from
csst_dfs_commons.utils.fits
import
get_header_value
,
get_healpix_id
,
get_healpix_ids
from
csst_dfs_commons.utils.fits
import
get_header_value
,
get_healpix_id
,
get_healpix_ids
log
=
logging
.
getLogger
(
'csst'
)
log
=
logging
.
getLogger
(
'csst'
)
...
@@ -18,7 +19,7 @@ class Level1DataApi(object):
...
@@ -18,7 +19,7 @@ class Level1DataApi(object):
self
.
db
=
DBClient
()
self
.
db
=
DBClient
()
def
make_sql_heapix
(
self
,
ra
,
dec
,
radius
,
ra_column
,
dec_column
,
hpix_column
):
def
make_sql_heapix
(
self
,
ra
,
dec
,
radius
,
ra_column
,
dec_column
,
hpix_column
):
arcDec
=
(
PI
/
180
)
*
dec
arcDec
=
(
constants
.
PI
/
180
)
*
dec
whereSql
=
f
"abs((180./pi()) * ACOS(SIN(pi() *
{
dec_column
}
/180) * SIN(
{
arcDec
}
) + COS(pi() *
{
dec_column
}
/180) * COS(
{
arcDec
}
) * COS((pi()/180) * (
{
ra_column
}
-
{
ra
}
)))) <
{
radius
}
"
whereSql
=
f
"abs((180./pi()) * ACOS(SIN(pi() *
{
dec_column
}
/180) * SIN(
{
arcDec
}
) + COS(pi() *
{
dec_column
}
/180) * COS(
{
arcDec
}
) * COS((pi()/180) * (
{
ra_column
}
-
{
ra
}
)))) <
{
radius
}
"
heapix_ids
=
get_healpix_ids
(
ra
,
dec
,
radius
,
128
)
heapix_ids
=
get_healpix_ids
(
ra
,
dec
,
radius
,
128
)
...
@@ -140,7 +141,7 @@ class Level1DataApi(object):
...
@@ -140,7 +141,7 @@ class Level1DataApi(object):
)
)
self
.
db
.
end
()
self
.
db
.
end
()
return
Result
.
ok_data
()
return
Result
.
ok_data
()
except
Exception
as
e
:
except
Exception
as
e
:
log
.
error
(
e
)
log
.
error
(
e
)
return
Result
.
error
(
message
=
str
(
e
))
return
Result
.
error
(
message
=
str
(
e
))
...
...
csst_dfs_api_local/mbi/level2.py
View file @
907aeaca
...
@@ -126,7 +126,7 @@ class Level2DataApi(object):
...
@@ -126,7 +126,7 @@ class Level2DataApi(object):
)
)
self
.
db
.
end
()
self
.
db
.
end
()
return
Result
.
ok_data
()
return
Result
.
ok_data
()
except
Exception
as
e
:
except
Exception
as
e
:
log
.
error
(
e
)
log
.
error
(
e
)
return
Result
.
error
(
message
=
str
(
e
))
return
Result
.
error
(
message
=
str
(
e
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment